News for hackers. Stuff that matters.
Re:How to move a running process into a tmux session (2020) by mindwok on Tuesday October 04, 2022 @09:19PM (#33089803)
I was curious how this worked so I did some reading which I found interesting. In short, this uses ptrace, which is the same Linux kernel mechanism used by debuggers, to attach to a running process and manipulate the open file descriptors (amongst other things) while it runs. So basically it attaches to the process, and changes stdin (fd 0) and stdout (fd 1) to point to your tmux session stdout and stdin.

Pretty cool use of ptrace.

Re:How to move a running process into a tmux session (2020) by eftychis on Tuesday October 04, 2022 @09:54PM (#33090081)
This is pretty cool! I had done something similar to connect isolated processes on the fly last year. But never thought to do that with tmux as a target.
Re:How to move a running process into a tmux session (2020) by ynbl_ on Wednesday October 05, 2022 @08:25AM (#33094532)
yes i didnt think theres a way to do this without hacks. unportable and fragile as expected.