Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Absolute minimum changes needed to support opening pipes for reading …

…and writing
  • Loading branch information...
commit 271741a99942b6e3f0e25f4189c44e03b38da614 1 parent 7c4c8b1
@japhb japhb authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/core/IO.pm
View
9 src/core/IO.pm
@@ -88,10 +88,11 @@ class IO does IO::FileTestable {
has $.path;
proto method open(|$) { * }
- multi method open($path? is copy, :$r, :$w, :$a, :$bin, :$chomp = Bool::True,
+ multi method open($path? is copy, :$r, :$w, :$a, :$p, :$bin, :$chomp = Bool::True,
:enc(:$encoding) = 'utf8') {
$path //= $.path;
- my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
+ my $mode = $p ?? ($w || $a ?? 'wp' !! 'rp') !!
+ ($w ?? 'w' !! ($a ?? 'wa' !! 'r' ));
# TODO: catch error, and fail()
nqp::bindattr(self, IO, '$!PIO',
$path eq '-'
@@ -329,8 +330,8 @@ sub rmdir($path) {
}
proto sub open(|$) { * }
-multi sub open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True, :enc(:$encoding) = 'utf8') {
- IO.new.open($path, :$r, :$w, :$a, :$bin, :$chomp, :$encoding);
+multi sub open($path, :$r, :$w, :$a, :$p, :$bin, :$chomp = Bool::True, :enc(:$encoding) = 'utf8') {
+ IO.new.open($path, :$r, :$w, :$a, :$p, :$bin, :$chomp, :$encoding);
}
proto sub lines(|$) { * }
Please sign in to comment.
Something went wrong with that request. Please try again.