summaryrefslogtreecommitdiff
path: root/t/io.dup
blob: 6f35892e8ad7794d5bc7cfed299b62ce42ac0247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!./perl

# $Header: io.dup,v 2.0 88/06/05 00:12:57 root Exp $

print "1..6\n";

print "ok 1\n";

open(dupout,">&stdout");
open(duperr,">&stderr");

open(stdout,">Io.dup") || die "Can't open stdout";
open(stderr,">&stdout") || die "Can't open stderr";

select(stderr); $| = 1;
select(stdout); $| = 1;

print stdout "ok 2\n";
print stderr "ok 3\n";
system 'echo ok 4';
system 'echo ok 5 1>&2';

close(stdout);
close(stderr);

open(stdout,">&dupout");
open(stderr,">&duperr");

system 'cat Io.dup';
unlink 'Io.dup';

print stdout "ok 6\n";