nelhage / reptyr

Reparent a running program to a new terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use case: attach to a bash shell

tobimensch opened this issue · comments

commented

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?

commented

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

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.