Skip to content

Commit d17d71a

Browse files
committed
Disable tmux autostart during env capture
Fixes #4
1 parent 2f84085 commit d17d71a

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const args = [
1111
const env = {
1212
// Disables Oh My Zsh auto-update thing that can block the process.
1313
DISABLE_AUTO_UPDATE: 'true',
14+
// Prevents the oh-my-zsh tmux plugin from auto-starting.
15+
ZSH_TMUX_AUTOSTARTED: 'true',
16+
ZSH_TMUX_AUTOSTART: 'false',
1417
};
1518

1619
const parseEnv = env => {

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ console.log(await shellEnv('/bin/bash'));
3030
> [!NOTE]
3131
> If your default shell is a non-POSIX shell (e.g., Nushell), it will fall back to `/bin/zsh` or `/bin/bash`.
3232
33+
> [!NOTE]
34+
> It disables the oh-my-zsh tmux plugin auto-start by setting `ZSH_TMUX_AUTOSTARTED` and `ZSH_TMUX_AUTOSTART=false` so the shell does not launch tmux while capturing environment variables.
35+
3336
### shellEnv(shell?)
3437

3538
Return a promise for the environment variables.

test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ test('async', async t => {
55
const env = await shellEnv();
66
t.true('HOME' in env);
77
t.false('' in env);
8+
t.is(env.ZSH_TMUX_AUTOSTARTED, 'true');
9+
t.is(env.ZSH_TMUX_AUTOSTART, 'false');
810
});
911

1012
test('sync', t => {
1113
const env = shellEnvSync();
1214
t.true('HOME' in env);
1315
t.false('' in env);
16+
t.is(env.ZSH_TMUX_AUTOSTARTED, 'true');
17+
t.is(env.ZSH_TMUX_AUTOSTART, 'false');
1418
});
1519

1620
test('async - with custom shell', async t => {

0 commit comments

Comments
 (0)