in reply to How do you properly tty-ify a non-tty STDOUT?
See this note in the IO::Pty documentation:if ($child) { $pty->close_slave(); return $pty; }
- close_slave()
- The slave filehandle will be closed and destroyed. This is necessary in the parent after forking to get rid of the open filehandle, otherwise the parent will not notice if the child exits. Subsequent calls of slave() will return a newly opened slave filehandle.
Also, it's customary to have the child start up a new process and have the parent continue the main flow of execution; your way will work, but isn't the normal way of doing things. And if you're using system(...); exit(0); in your actual program (and not just this sample code), consider using exec instead.
Update: Yup, I misread ph713's code; it forks in a perfectly normal way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do you properly tty-ify a non-tty STDOUT?
by ph713 (Pilgrim) on Sep 22, 2004 at 17:47 UTC | |
|
Re^2: How do you properly tty-ify a non-tty STDOUT?
by ph713 (Pilgrim) on Sep 22, 2004 at 17:54 UTC |