Repository navigation
fix(remote): run the pane wrapper under env so Ghostty's exec cannot drop it - #654
Merged
Merged
Conversation
…drop it libghostty runs a surface command as bash -c "exec -l <command>", so the exec replaced the shell with ssh and nothing after it ran: the pane never printed its "disconnected, exit N" line. Wrapping the script in /usr/bin/env /bin/sh -c gives the exec to env and keeps sh non-login. Claude-Session: https://claude.ai/code/session_01GiNNp4Fiq8JFqMxqz3N9x6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The pane command for a remote session is
ssh … zmx attach …; status=$?; printf '<disconnected line>'; exit "$status". libghostty runs a surface command asbash -c "exec -l <command>", so bash replaces itself with ssh on the first word and nothing after it runs. The result on master: when ssh exits, the pane shows nothing. The lineagterm: <session> (<pane>) on <host> disconnected, exit NthatattachPaneCommandprints is never printed, and the docs describe a line the user does not see. I found this while working on the reconnect from #644, because the reconnect branch of the wrapper did not start either.The fix
The script is wrapped in
/usr/bin/env /bin/sh -c '<script>'. Theexecnow replaces bash withenv,envrunssh, and the script runs to its end.shis used directly and not throughlogin, so it reads no profile. Nothing else changes: the pane still exits with the ssh status, and the line is the same text as before.The new test runs the pane command through
bash -c "exec -l …", the way libghostty runs it. On master it fails with an empty stdout; with the fix it prints the line and exits 23.Verification
swift test(RemoteSessionTests, 26 tests) andmake lintare clean. This is the first PR of the reconnect work discussed in #644; the reconnect PR is based on it.