| Revision: | 1.1 |
| Committed: | Thu Feb 17 15:07:48 2005 UTC (21 years, 7 months ago) by root |
| Branch: | MAIN |
| Log Message: | *** empty log message *** |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | root | 1.1 | #!/usr/bin/perl |
| 2 | |||
| 3 | use IO::Pty; | ||
| 4 | use Fcntl; | ||
| 5 | |||
| 6 | my $pty = new IO::Pty; | ||
| 7 | fcntl $pty, F_SETFD, 0; # clear close-on-exec | ||
| 8 | |||
| 9 | system "rxvt -pty-fd " . (fileno $pty) . "&"; | ||
| 10 | |||
| 11 | # now communicate with rxvt | ||
| 12 | my $slave = $pty->slave; | ||
| 13 | |||
| 14 | print $slave "hi! please enter something and press return (ctrl-d to exit):\n"; | ||
| 15 | |||
| 16 | while (<$slave>) { | ||
| 17 | print $slave "you entered: $_"; | ||
| 18 | } | ||
| 19 |