News for hackers. Stuff that matters.
Re:How to move a running process into a tmux session (2020) by amelius on Tuesday October 04, 2022 @06:59PM (#33088302)
One problem of course is that you miss the output of the process from before you took over control. Perhaps shells could be extended to better support this way of using tmux/screen.

By the way another approach is of course to use VNC (e.g. some process started in an xterm at work you can access by opening your entire desktop at home.)

Re:How to move a running process into a tmux session (2020) by linsomniac on Tuesday October 04, 2022 @07:09PM (#33088403)
Doesn't really feel like the shell would be the right place to do this, as the shell really has no idea, in most cases, of the output history. The whole idea of the scrollback is in the terminal, so it'd probably be, ultimately, the terminal that is the source of this information.

kitty probably has some abilities to do this easily from the shell, as it has all sorts of abilities to interact programmatically with the scrollback history.

Re:How to move a running process into a tmux session (2020) by amelius on Tuesday October 04, 2022 @07:12PM (#33088435)
Good point.

How about starting tmux by default inside a terminal, rather than running the shell directly inside the terminal?

Of course, an ssh session would also need to start tmux.

Re:How to move a running process into a tmux session (2020) by cryptonector on Tuesday October 04, 2022 @11:15PM (#33090701)
No need to `bg` the process. The `reptyr` tool should set it to run once it's gotten ptrace control over it.
Re:How to move a running process into a tmux session (2020) by cbm-vic-20 on Tuesday October 04, 2022 @08:15PM (#33089139)
This sounds like something that mosh was built for.

https://mosh.org/

Re:How to move a running process into a tmux session (2020) by freedomben on Tuesday October 04, 2022 @08:51PM (#33089497)
Mosh helps of course by not killing the child process on timeout, but you'll miss all the console output without something like tmux