Skip to content
Permalink
Browse files

[js] When faking a process in the browser assign it a new pid

  • Loading branch information...
pmurias committed Dec 13, 2018
1 parent 7a68df2 commit 8f2d9ed0d9f16f4599b326b7d4583fbc313e923b
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/vm/js/rakudo-library.js
@@ -74,6 +74,14 @@ module.exports.capturedRun = /*async*/ function(source, input, compileArgs, args

const env = nqp.hash();

const pid = core.randomInt()[0];

const oldGetpid = nqp.op.getpid;

nqp.op.getpid = function() {
return pid;
};

passedEnv.content.forEach((value, key, map) => {
env.content.set(key, new nqp.NQPStr(value.$$getStr()));
});
@@ -179,6 +187,7 @@ module.exports.capturedRun = /*async*/ function(source, input, compileArgs, args
nqp.op.open = oldOpen;
nqp.args = oldArgs;
nqp.op.getenvhash = oldGetEnvHash;
nqp.op.getpid = oldGetpid;

nqp.setGlobalContext(oldGlobalContext);

0 comments on commit 8f2d9ed

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