From 799aecd501553662613128d83913b768857076b7 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 17 Dec 2024 13:00:55 -0800 Subject: [PATCH] Add ZDOTDIR after JWT token for WSL commands (#1546) --- pkg/shellexec/shellexec.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/shellexec/shellexec.go b/pkg/shellexec/shellexec.go index d22cdbb1f..2c811d85c 100644 --- a/pkg/shellexec/shellexec.go +++ b/pkg/shellexec/shellexec.go @@ -167,9 +167,6 @@ func StartWslShellProc(ctx context.Context, termSize waveobj.TermSize, cmdStr st homeDir := wsl.GetHomeDir(conn.Context, client) shellOpts = append(shellOpts, "~", "-d", client.Name()) - if isZshShell(shellPath) { - shellOpts = append(shellOpts, fmt.Sprintf(`ZDOTDIR="%s/.waveterm/%s"`, homeDir, shellutil.ZshIntegrationDir)) - } var subShellOpts []string if cmdStr == "" { @@ -216,6 +213,10 @@ func StartWslShellProc(ctx context.Context, termSize waveobj.TermSize, cmdStr st } else { shellOpts = append(shellOpts, "--", fmt.Sprintf(`%s=%s`, wshutil.WaveJwtTokenVarName, jwtToken)) } + + if isZshShell(shellPath) { + shellOpts = append(shellOpts, fmt.Sprintf(`ZDOTDIR="%s/.waveterm/%s"`, homeDir, shellutil.ZshIntegrationDir)) + } shellOpts = append(shellOpts, shellPath) shellOpts = append(shellOpts, subShellOpts...) log.Printf("full cmd is: %s %s", "wsl.exe", strings.Join(shellOpts, " "))