Commit | Line | Data |
---|---|---|
378cc40b | 1 | #!./perl |
2 | ||
79072805 | 3 | # $RCSfile: dup.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:27 $ |
378cc40b | 4 | |
e4a4387c | 5 | print "1..8\n"; |
378cc40b | 6 | |
7 | print "ok 1\n"; | |
8 | ||
a687059c | 9 | open(dupout,">&STDOUT"); |
10 | open(duperr,">&STDERR"); | |
378cc40b | 11 | |
a687059c | 12 | open(STDOUT,">Io.dup") || die "Can't open stdout"; |
13 | open(STDERR,">&STDOUT") || die "Can't open stderr"; | |
378cc40b | 14 | |
a687059c | 15 | select(STDERR); $| = 1; |
16 | select(STDOUT); $| = 1; | |
378cc40b | 17 | |
a687059c | 18 | print STDOUT "ok 2\n"; |
19 | print STDERR "ok 3\n"; | |
68dc0745 | 20 | print `echo ok 4`; |
21 | print `echo ok 5 1>&2`; # does this work? | |
e4a4387c | 22 | system 'echo ok 6'; |
23 | system 'echo ok 7 1>&2'; | |
378cc40b | 24 | |
a687059c | 25 | close(STDOUT); |
26 | close(STDERR); | |
378cc40b | 27 | |
a687059c | 28 | open(STDOUT,">&dupout"); |
29 | open(STDERR,">&duperr"); | |
378cc40b | 30 | |
2986a63f | 31 | if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) { print `type Io.dup` } |
68dc0745 | 32 | else { system 'cat Io.dup' } |
378cc40b | 33 | unlink 'Io.dup'; |
34 | ||
e4a4387c | 35 | print STDOUT "ok 8\n"; |
9394203c | 36 |