Revision: | 1.2 |
Committed: | Thu Feb 17 15:13:47 2005 UTC (19 years, 4 months ago) by root |
Branch: | MAIN |
Changes since 1.1: | +1 -0 lines |
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 | root | 1.2 | close $pty; |
11 | root | 1.1 | |
12 | # now communicate with rxvt | ||
13 | my $slave = $pty->slave; | ||
14 | |||
15 | print $slave "hi! please enter something and press return (ctrl-d to exit):\n"; | ||
16 | |||
17 | while (<$slave>) { | ||
18 | print $slave "you entered: $_"; | ||
19 | } | ||
20 |