Skip to content
Permalink
Browse files

[js] Add a run(:fake-run, ...) multi candidate

It's used to fake is_run when running in the browser
  • Loading branch information...
pmurias committed Mar 27, 2019
1 parent 6e650cd commit b0668b263607377e04d9a2dca88dff5b7415894b
Showing with 28 additions and 0 deletions.
  1. +27 −0 src/vm/js/FakeRun.pm6
  2. +1 −0 tools/build/js_core_sources
@@ -0,0 +1,27 @@
multi sub run(Str $code, Str $input?, :@args, :@compiler-args, :$fake-run!) {
my Mu $compiler-args-s := nqp::list_s();
my Mu $args-s := nqp::list_s();

for @compiler-args -> $arg {
nqp::push_s($compiler-args-s, $arg.Str);
}

for @args -> $arg {
nqp::push_s($args-s, $arg.Str);
}

my Mu $result := nqp::p6fakerun(nqp::hash(
'code', $code,
'input', $input,
'compiler-args', $compiler-args-s,
'args', $args-s,
'env', CLONE-HASH-DECONTAINERIZED(%*ENV)
));

my %out;
%out<status> = nqp::atkey($result, 'status');
%out<out> = nqp::atkey($result, 'out');
%out<err> = nqp::atkey($result, 'err');

%out;
}
@@ -174,6 +174,7 @@ src/core/IO/Socket.pm6
src/core/IO/Socket/INET.pm6
src/core/IO/Socket/Async.pm6
src/core/Proc.pm6
src/vm/js/FakeRun.pm6
src/core/signals.pm6
src/core/Proc/Async.pm6
src/core/Systemic.pm6

0 comments on commit b0668b2

Please sign in to comment.
You can’t perform that action at this time.