Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eagerness is better than laziness
for mkdir, unlink, rmdir and chmod  :-)
  • Loading branch information
lizmat committed Oct 3, 2014
1 parent d69a874 commit 07d6050
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/io_operators.pm
Expand Up @@ -150,18 +150,18 @@ nqp::bindattr(nqp::decont(PROCESS::<$ERR>),
IO::Handle, '$!PIO', nqp::getstderr());

sub chmod($mode, *@filenames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@filenames.grep( *.IO(:$SPEC,:$CWD).chmod($mode) );
@filenames.grep( *.IO(:$SPEC,:$CWD).chmod($mode) ).eager;
}
sub unlink(*@filenames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@filenames.grep( *.IO(:$SPEC,:$CWD).unlink );
@filenames.grep( *.IO(:$SPEC,:$CWD).unlink ).eager;
}
sub rmdir(*@filenames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@filenames.grep( *.IO(:$SPEC,:$CWD).rmdir );
@filenames.grep( *.IO(:$SPEC,:$CWD).rmdir ).eager;
}

proto sub mkdir(|) { * }
multi sub mkdir(Int $mode, *@dirnames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@dirnames.grep( *.IO(:$SPEC,:$CWD).mkdir($mode) );
@dirnames.grep( *.IO(:$SPEC,:$CWD).mkdir($mode) ).eager;
}
multi sub mkdir($path, $mode = 0o777, :$SPEC = $*SPEC, :$CWD = $*CWD) {
$path.IO(:$SPEC,:$CWD).mkdir($mode) ?? ($path,) !! ();
Expand Down

0 comments on commit 07d6050

Please sign in to comment.