nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.71k stars 216 forks source link

Correction on ^C/^Z #123

Open Eviepayne opened 3 years ago

Eviepayne commented 3 years ago

After attaching, the process will take input from and write output to the new terminal, including ^C and ^Z. (Unfortunately, if you background it, you will still have to run "bg" or "fg" in the old terminal. This is likely impossible to fix in a reasonable way without patching your shell.)

While backgrounded you can open your terminal multiplexor (like tmux or screen) reptyr $PID detach from the session, then while it is backgrounded. jobs Get the name of the $0 argument (usually sudo or the binary name) disown $binaryname Which will detach the process from your existing terminal, leaving the terminal multiplexor session independant.