Skip to content

Commit

Permalink
Re-work shell in terms of spawn.
Browse files Browse the repository at this point in the history
Since there's really not much difference, and no reason to make a
distinction at the VM op level that is so easily replicated at the
Perl 6 level.
  • Loading branch information
jnthn committed Jun 12, 2017
1 parent 3da8025 commit 40dd369
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/Proc.pm
Expand Up @@ -92,21 +92,21 @@ my class Proc {
method spawn(*@args where .so, :$cwd = $*CWD, :$env) {
@!command = @args;
my %env := $env ?? $env.hash !! %*ENV;
self.status(nqp::p6box_i(nqp::spawn(
CLONE-LIST-DECONTAINERIZED(@args),
nqp::unbox_s($cwd.Str),
CLONE-HASH-DECONTAINERIZED(%env),
$!in_fh, $!out_fh, $!err_fh,
$!flags
)));
self.Bool
self!spawn-internal(@args, $cwd, %env)
}

method shell($cmd, :$cwd = $*CWD, :$env) {
@!command = $cmd;
my %env := $env ?? $env.hash !! %*ENV;
self.status(nqp::p6box_i(nqp::shell(
nqp::unbox_s($cmd),
my @args := Rakudo::Internals.IS-WIN
?? (%*ENV<ComSpec>, '/c', $cmd)
!! ('/bin/sh', '-c', $cmd);
self!spawn-internal(@args, $cwd, %env)
}

method !spawn-internal(@args, $cwd, %env) {
self.status(nqp::p6box_i(nqp::spawn(
CLONE-LIST-DECONTAINERIZED(@args),
nqp::unbox_s($cwd.Str),
CLONE-HASH-DECONTAINERIZED(%env),
$!in_fh, $!out_fh, $!err_fh,
Expand Down

0 comments on commit 40dd369

Please sign in to comment.