… | |
… | |
5 | |
5 | |
6 | my $pty = new IO::Pty; |
6 | my $pty = new IO::Pty; |
7 | fcntl $pty, F_SETFD, 0; # clear close-on-exec |
7 | fcntl $pty, F_SETFD, 0; # clear close-on-exec |
8 | |
8 | |
9 | system "rxvt -pty-fd " . (fileno $pty) . "&"; |
9 | system "rxvt -pty-fd " . (fileno $pty) . "&"; |
|
|
10 | close $pty; |
10 | |
11 | |
11 | # now communicate with rxvt |
12 | # now communicate with rxvt |
12 | my $slave = $pty->slave; |
13 | my $slave = $pty->slave; |
13 | |
14 | |
14 | print $slave "hi! please enter something and press return (ctrl-d to exit):\n"; |
15 | print $slave "hi! please enter something and press return (ctrl-d to exit):\n"; |