fix(desktop): source shell profile in teardown via wrappers#1416
Conversation
Teardown scripts used getShellEnvironment() which spawned a separate login shell to capture env, bypassing the shell wrapper system that terminal/setup use. This meant teardown didn't get ~/.superset/bin in PATH or go through the same profile sourcing as the terminal. Switch to buildSafeEnv + getShellEnv (ZDOTDIR) + a new getCommandShellArgs helper that explicitly sources wrapper profiles for non-interactive command execution.
📝 WalkthroughWalkthroughRefactors workspace teardown to use new shell wrapper helpers and sanitized environment composition. Adds and exports Changes
Sequence DiagramsequenceDiagram
participant Teardown as Teardown
participant ShellWrapper as ShellWrapper
participant Sanitizer as EnvSanitizer
participant Spawner as ChildProcess
Teardown->>Sanitizer: sanitizeEnv(process.env)
Sanitizer-->>Teardown: baseEnv
Teardown->>ShellWrapper: getCommandShellArgs(shell, command)
ShellWrapper-->>Teardown: computedArgs
Teardown->>Teardown: mergedEnv = baseEnv + wrapperEnv + SUPSERSET vars
Teardown->>Spawner: spawn(shell, computedArgs, { env: mergedEnv, stdio: 'inherit' })
Spawner-->>Teardown: process started
Teardown->>Spawner: listen "exit"
Spawner-->>Teardown: emit "exit"
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
~/.superset/binin PATH or source profiles the same way the terminal doesbuildSafeEnv+getShellEnv+ newgetCommandShellArgsto match the terminal's profile sourcingChanges
shell-wrappers.ts: AddedgetCommandShellArgs(shell, command)for non-interactive command execution that sources wrapper profiles inline (needed because--rcfileis ignored with-cin bash, and.zshrcis skipped in non-interactive zsh)teardown.ts: ReplacedgetShellEnvironment()(spawned a separate login shell) with the shell wrapper approach —buildSafeEnv+getShellEnvfor env,getCommandShellArgsfor argsindex.ts: Re-exportsgetCommandShellArgsTest Plan
~/.superset/bin(e.g. agent wrappers)Summary by CodeRabbit