Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Return $*IN and $*OUT rather than create a new IO::Handle
This allows for $*IN.ins to always have the number of lines read from
stdin no matter how stdin was opened.  See RT#113100
  • Loading branch information
perlpilot committed Jul 24, 2015
1 parent b8d3772 commit 6f292f5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/core/IO/Handle.pm
Expand Up @@ -69,14 +69,13 @@ my class IO::Handle does IO {
}

if $!path eq '-' {
$!path = IO::Special.new:
what => do given $mode {
when 'ro' { '<STDIN>' }
when 'wo' { '<STDOUT>' }
default {
die "Cannot open standard stream in mode '$_'";
}
given $mode {
when 'ro' { return $*IN; }
when 'wo' { return $*OUT; }
default {
die "Cannot open standard stream in mode '$_'";
}
}
}

if nqp::istype($!path, IO::Special) {
Expand Down

0 comments on commit 6f292f5

Please sign in to comment.