Skip to content

[BUG] [v0.0.7] InteractiveSession::start() hardcodes 'sh' shell, fails on Windows (command_executor.rs:543) #18535

Description

@echoforge2200

Description

The InteractiveSession::start() method hardcodes the shell command as "sh" without any platform detection. This causes the method to fail on Windows where sh is not available by default. Unlike other parts of the codebase that check cfg!(windows) to use cmd on Windows vs sh on Unix, this method unconditionally uses Unix shell syntax.

Verified by comparing with:

  • CommandExecutor::execute() (lines 196-209): Uses if cfg!(windows) { "cmd" } else { "sh" }
  • StreamingExecutor::execute() (lines 442-454): Uses same platform detection
  • InteractiveSession::start() (lines 542-555): Missing platform check, always uses "sh"

Error Message

Failed to spawn: The system cannot find the file specified. (os error 2)

Debug Logs

On Windows, calling InteractiveSession::start("any command") will fail with a file not found error because 'sh' is not in the system PATH.

System Information

Windows platforms

Steps to Reproduce

  1. On Windows, call InteractiveSession::start("echo hello")
  2. Observe that it fails with 'file not found' error
  3. Compare with CommandExecutor which correctly uses 'cmd' on Windows

Expected Behavior

InteractiveSession::start() should detect the platform and use 'cmd /C' on Windows and 'sh -c' on Unix, consistent with other methods in the same file.

Actual Behavior

InteractiveSession::start() always uses 'sh -c' which fails on Windows.

Additional Context

In src/cortex-engine/src/command_executor.rs, lines 542-555, InteractiveSession::start() hardcodes 'sh' as the shell. This is inconsistent with StreamingExecutor::execute() and CommandExecutor::execute() which both check cfg!(windows) to use the appropriate shell for the platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions