Commit | Line | Data |
378cc40b |
1 | #!./perl |
2 | |
3 | # $Header: io.dup,v 2.0 88/06/05 00:12:57 root Exp $ |
4 | |
5 | print "1..6\n"; |
6 | |
7 | print "ok 1\n"; |
8 | |
9 | open(dupout,">&stdout"); |
10 | open(duperr,">&stderr"); |
11 | |
12 | open(stdout,">Io.dup") || die "Can't open stdout"; |
13 | open(stderr,">&stdout") || die "Can't open stderr"; |
14 | |
15 | select(stderr); $| = 1; |
16 | select(stdout); $| = 1; |
17 | |
18 | print stdout "ok 2\n"; |
19 | print stderr "ok 3\n"; |
20 | system 'echo ok 4'; |
21 | system 'echo ok 5 1>&2'; |
22 | |
23 | close(stdout); |
24 | close(stderr); |
25 | |
26 | open(stdout,">&dupout"); |
27 | open(stderr,">&duperr"); |
28 | |
29 | system 'cat Io.dup'; |
30 | unlink 'Io.dup'; |
31 | |
32 | print stdout "ok 6\n"; |