Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[IO] Add &chdir and &mkdir
  • Loading branch information
Tadeusz Sośnierz committed Aug 24, 2011
1 parent f638895 commit 6e4aa6c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/IO.pm
Expand Up @@ -196,6 +196,22 @@ sub dir($path = '.', Mu :$test = none('.', '..')) {

}

proto sub chdir(|$) { * }
multi sub chdir($path as Str) {
try {
pir::new__PS('OS').chdir($path)
}
$! ?? fail($!) !! True
}

proto sub mkdir(|$) { * }
multi sub mkdir($path as Str, $mode = 0o777) {
try {
pir::new__PS('OS').mkdir($path, $mode)
}
$! ?? fail($!) !! True
}

$PROCESS::IN = open('-');
$PROCESS::OUT = open('-', :w);
$PROCESS::ERR = IO.new;
Expand Down

0 comments on commit 6e4aa6c

Please sign in to comment.