nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.8k stars 215 forks source link

Use case: attach to a bash shell #77

Closed tobimensch closed 8 years ago

tobimensch commented 8 years ago

to execute a few commands there.

And then unattach from it again (restoring the state before reptyr was used at all).

The idea is to get information from the bash shell (last command(s) run, env variables, current directory, and so forth), or even to run arbitrary commands there, but then to restore it to a usable state, as if reptyr had never done anything to it (and it works in all terminals correctly again).

Is this sort of use case possible with reptyr?

Can you give a short instructions?

tobimensch commented 8 years ago

What I mean by restoring it to a usable state is, that I want it to run inside its original terminal again.

nelhage commented 8 years ago

reptyr doesn't natively support "detaching" from a process once it's been attached, and it would be tricky to do so. You might be able to re-reptyr the process back from the original shell, but in general I'd recommend using a tool like screen(1) or tmux(1) if you know you're going to be wanting to move shells around a bunch.