Hacker News new | past | comments | ask | show | jobs | submit login
Reptyr – Reparent a running program to a new terminal (github.com/nelhage)
53 points by pmoriarty on Dec 7, 2014 | hide | past | favorite | 10 comments



There was some discussion on the NetBSD list today as to how you might do this properly, ie with OS support not some hacks [1]. Although it is not clear it is worth bothering, as you just use screen first...

[1] http://blog.gmane.org/gmane.os.netbsd.devel.kernel


This is useful for those cases where you didn't start screen first, such as when you either forgot or didn't think you'd need it but it turned out you did.


I just alias my terminal shortcut/command to start screen/tmux every time


Doesn't using screen have some drawbacks? For example it breaks native scrolling in the OS X terminal app, so I wouldn't want to run screen unless I really needed it.


Yeah I don't know. I only mentioned screen to be fair. I use tmux and I don't usually have any problems, although I get problems when I use it with mosh sometimes (particularly weechat mouse support doesn't seem to work well).


This may be a dumb question, but wouldn't this work?

* press ctrl-z to put the program in the background

* start screen

* run fg within screen


screen (and tmux) start a new instance of the shell, which would have no knowledge of the backgrounded process. You'd just see the message "fg: no current job"


And even if you could(1), the background process typically has the terminal open - and screen uses a separate pseudo terminal aka pty -- As suggested by the name - rePTYr

(1) ^Z sends SIGSTOP; to continue you can signal SIGCONT. But then what?!



I tried this several times and it rarely works.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: