Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Forget about grep, just do a for loop
  • Loading branch information
lizmat committed Oct 3, 2014
1 parent f948d73 commit 8d3f759
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/core/io_operators.pm
Expand Up @@ -150,13 +150,28 @@ 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) ).eager;
my @ok;
for @filenames -> $file {
@ok.push($file) if $file.IO(:$SPEC,:$CWD).chmod($mode);
}
@ok;
# @filenames.grep( *.IO(:$SPEC,:$CWD).chmod($mode) ).eager;
}
sub unlink(*@filenames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@filenames.grep( *.IO(:$SPEC,:$CWD).unlink ).eager;
my @ok;
for @filenames -> $file {
@ok.push($file) if $file.IO(:$SPEC,:$CWD).unlink;
}
@ok;
# @filenames.grep( *.IO(:$SPEC,:$CWD).unlink ).eager;
}
sub rmdir(*@filenames, :$SPEC = $*SPEC, :$CWD = $*CWD) {
@filenames.grep( *.IO(:$SPEC,:$CWD).rmdir ).eager;
my @ok;
for @filenames -> $file {
@ok.push($file) if $file.IO(:$SPEC,:$CWD).rmdir;
}
@ok;
# @filenames.grep( *.IO(:$SPEC,:$CWD).rmdir ).eager;
}

proto sub mkdir(|) { * }
Expand Down

0 comments on commit 8d3f759

Please sign in to comment.