Add ZDOTDIR after JWT token for WSL commands (#1546)

This commit is contained in:
Evan Simkowitz 2024-12-17 13:00:55 -08:00 committed by GitHub
parent f5305cc8dd
commit 799aecd501
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,9 +167,6 @@ func StartWslShellProc(ctx context.Context, termSize waveobj.TermSize, cmdStr st
homeDir := wsl.GetHomeDir(conn.Context, client) homeDir := wsl.GetHomeDir(conn.Context, client)
shellOpts = append(shellOpts, "~", "-d", client.Name()) shellOpts = append(shellOpts, "~", "-d", client.Name())
if isZshShell(shellPath) {
shellOpts = append(shellOpts, fmt.Sprintf(`ZDOTDIR="%s/.waveterm/%s"`, homeDir, shellutil.ZshIntegrationDir))
}
var subShellOpts []string var subShellOpts []string
if cmdStr == "" { if cmdStr == "" {
@ -216,6 +213,10 @@ func StartWslShellProc(ctx context.Context, termSize waveobj.TermSize, cmdStr st
} else { } else {
shellOpts = append(shellOpts, "--", fmt.Sprintf(`%s=%s`, wshutil.WaveJwtTokenVarName, jwtToken)) 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, shellPath)
shellOpts = append(shellOpts, subShellOpts...) shellOpts = append(shellOpts, subShellOpts...)
log.Printf("full cmd is: %s %s", "wsl.exe", strings.Join(shellOpts, " ")) log.Printf("full cmd is: %s %s", "wsl.exe", strings.Join(shellOpts, " "))