Permalink
Browse files

Add a COPYING and README.

  • Loading branch information...
1 parent 189df96 commit e30d4ad0a9d5a522e7b20d319f49f2276502ad8f @nelhage committed Jan 22, 2011
Showing with 93 additions and 0 deletions.
  1. +19 −0 COPYING
  2. +74 −0 README
View
19 COPYING
@@ -0,0 +1,19 @@
+Copyright (C) 2011 by Nelson Elhage
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
74 README
@@ -0,0 +1,74 @@
+reptyr - A tool for "re-ptying" programs.
+-----------------------------------------
+
+reptyr is a utility for taking an existing running program and
+attaching it to a new terminal. Started a long-running process over
+ssh, but have to leave and don't want to interrupt it? Just start a
+screen, use reptyr to grab it, and then kill the ssh session and head
+on home.
+
+USAGE
+-----
+
+"reptyr PID" will grab the process with id PID and attach it to your
+current terminal.
+
+After attaching, the process will take input from and write output to
+the new terminal, including ^C and ^Z. Unfortunately, if you
+background it, you will still have to run "bg" or "fg" in the old
+terminal. This is likely impossible to fix in a reasonable way without
+patching your shell.
+
+After attaching, you may need to send a ^L or similar to ncurses
+applications to force them to redraw themselves. With "less", after
+attaching, a ^Z will cause it to both redraw and to set up the
+terminal application keys so that you can scroll with arrow keys
+again.
+
+"But wait, isn't this just screenify?"
+--------------------------------------
+
+There's a shell script called "screenify" that's been going around the
+internet for nigh on 10 years now that uses gdb to (supposedly)
+accomplish the same thing. The difference is that reptyr works much,
+much, better.
+
+If you attach a "less" using screenify, it will still take input from
+the old terminal. If you attach an ncurses program using screenify,
+and resize the window, your program won't notice. If you attach a
+process with screenify, ^C in the new terminal won't work.
+
+reptyr fixes all of these problems, and is the only such tool I know
+of that does so. See below for some more details on how it
+accomplishes this.
+
+
+reptyr -l
+---------
+
+As a bonus feature, if you run "reptyr -l", reptyr will create a new
+pseudo-terminal pair with nothing attached to the slave end, and print
+its name out.
+
+If you are debugging a program in gdb, you can pass that name to "set
+inferior-pty". Because there is no existing program listening to that
+tty, this will work much better than passing an existing shell's
+terminal.
+
+How does it work?
+-----------------
+
+The main thing that reptyr does that no one else does is that it
+actually changes the controlling terminal of the process you are
+attaching. I plan on writing up more about just how this works soon,
+but for now, the source is only about 1000 lines if you're curious :)
+
+
+CREDITS
+-------
+reptyr was written by Nelson Elhage <nelhage@nelhage.com>. Contact him
+with any questions or bug reports.
+
+URL
+---
+http://github.com/nelhage/reptyr

0 comments on commit e30d4ad

Please sign in to comment.