Skip to content

Enable Ctrl+Z (job control) in Podman interactive mode#409

Open
phryneas wants to merge 1 commit intomattpocock:mainfrom
phryneas:pr/podman-interactive-ctrl-z
Open

Enable Ctrl+Z (job control) in Podman interactive mode#409
phryneas wants to merge 1 commit intomattpocock:mainfrom
phryneas:pr/podman-interactive-ctrl-z

Conversation

@phryneas
Copy link
Copy Markdown

@phryneas phryneas commented Apr 22, 2026

--- Human note:

I wanted to be able to drop out of interactive sessions into the container, to run commands, see what's available in the container for Claude to use and essentially have a good starting point to debug the whole thing.
This isn't really beautiful, but works nicely for me. Still, please test it by going through the test plan before merging :)

--- AI PR:

Summary

  • Wraps the agent command in an interactive bash session with set -m (job control enabled), so Ctrl+Z suspends only the agent process while bash retains terminal control
  • The init script is written to /tmp/.sc_init.sh via a base64 round-trip to survive any special characters in the command args
  • PROMPT_COMMAND resets the terminal with stty sane on resume, and exits bash once the agent job is gone (normal exit) — but not when it's merely stopped, so fg correctly resumes it

Test plan

  • Run sandcastle in Podman interactive mode and press Ctrl+Z — agent should suspend and drop to a shell prompt
  • Type fg to resume the agent — it should continue from where it left off
  • Verify normal exit (no Ctrl+Z) still works: bash exits cleanly when the agent finishes
  • Verify non-TTY mode (piped stdin) still works: init script is still written, bash runs non-interactively

🤖 Generated with Claude Code

Wraps the agent command in a bash session with `set -m` (job control
enabled) and writes it to /tmp/.sc_init.sh via base64 to avoid shell
quoting issues. Bash runs it as a foreground job, so Ctrl+Z suspends
just the agent while the shell retains terminal control. `fg` resumes
it. PROMPT_COMMAND resets the terminal on resume and exits bash once
the agent job is no longer running (normal exit), but not when it is
stopped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@phryneas is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel.

A member of the Team first needs to authorize it.

@phryneas
Copy link
Copy Markdown
Author

Oh, I just wanted to add: feel free to close if it doesn't fit the direction you're going :)
I have a local pnpm patch for this going on, just wanted to contribute it back in case you think it might be useful.

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.

1 participant