Skip to content

fix(sdk): add capture_exit_code option to nohup mode#686

Open
Issac-Newton wants to merge 1 commit intoalibaba:masterfrom
Issac-Newton:fix/nohup-capture-exit-code
Open

fix(sdk): add capture_exit_code option to nohup mode#686
Issac-Newton wants to merge 1 commit intoalibaba:masterfrom
Issac-Newton:fix/nohup-capture-exit-code

Conversation

@Issac-Newton
Copy link
Copy Markdown
Collaborator

Summary

  • Add capture_exit_code: bool = False parameter to Sandbox.arun() — when True and mode="nohup", wraps the command in a subshell that captures the real exit code into a .rc file
  • Internal plumbing: start_nohup_process generates subshell command when exit_code_file is set; handle_nohup_output reads the .rc file after process completion
  • Update integration test test_arun_nohup_nonexistent_command_exit_code to assert exit_code == 127
  • Add spec docs under docs/_specs/nohup-exit-code/

Test plan

  • All 7 unit tests pass (tests/unit/sdk/test_arun_nohup.py)
  • All 10 integration tests pass (tests/integration/sdk/sandbox/test_sdk_client.py -m need_admin)
  • capture_exit_code=False (default) — existing behavior unchanged
  • capture_exit_code=True + non-existent command → exit_code=127

fixes #685

🤖 Generated with Claude Code

…ohup mode

Previously arun() in nohup mode always returned exit_code=0 on success regardless
of whether the underlying command failed (e.g. command not found → 127).

Add capture_exit_code: bool = False to arun(). When True, the nohup command is
wrapped in a subshell that writes cmd's exit code to a .rc file; handle_nohup_output
reads it after process completion. Default False preserves existing behavior.

Also add spec docs under docs/_specs/nohup-exit-code/ and update the integration
test to assert exit_code == 127 for a non-existent command.

Closes alibaba#685

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

fix(sdk): nohup mode always returns exit_code=0 regardless of command result

1 participant