Skip to content

Conversation

@kevinkre
Copy link

  • Import platform module for OS detection
  • Create getShellCommand() helper for platform-specific shell selection
  • Use cmd.exe on Windows, /bin/bash on Unix
  • Update BashSession.initialize() and executeBashCommand()
  • Maintains backwards compatibility with Unix systems

- Import platform module for OS detection
- Create getShellCommand() helper for platform-specific shell selection
- Use cmd.exe on Windows, /bin/bash on Unix
- Update BashSession.initialize() and executeBashCommand()
- Maintains backwards compatibility with Unix systems
@RyanNg1403
Copy link
Collaborator

@codex review this PR

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 78 to 82
try {
// Start bash process with non-interactive mode to avoid prompt issues
this.process = spawn('/bin/bash', [], {
const { shell, args } = getShellCommand();
this.process = spawn(shell, args, {
cwd: this.currentWorkingDir,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Persistent sessions spawn non-interactive shell

The new getShellCommand always adds ['-c'] (or ['/c'] on Windows) and initialize() now uses those args when starting the persistent shell. Both bash -c and cmd.exe /c immediately exit after running a command, so launching them without a command ends the process at once and the BashSession never stays active. As a result, any call to the tool with persistent: true fails on all platforms because session.executeCommand will throw "Bash session is not running". Persistent sessions need an interactive shell (bash with no -c, cmd.exe without /c or with /K).

Useful? React with 👍 / 👎.

@RyanNg1403
Copy link
Collaborator

@kevinkre
Adding getShellCommand() is a good start toward Windows compatibility, but the new launch logic unintentionally breaks the existing Unix/Linux session flow.

BashSession.initialize() now calls spawn(shell, args, …) where args is ['-c'] (Unix) or ['/c'] (Windows). Both shells expect another argument containing the command when -c//c is supplied; without it they exit immediately (e.g., bash -c produces “option requires an argument”). Because the persistent session relies on writing commands to stdin after startup, this change causes the session to terminate before any command can be run, regressing all persistent shell usage.

I recommend adjusting the helper so that persistent sessions are launched without -c//c, while one-off executions still append those flags alongside the command string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants