Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/cwlNodeEngineWithContext.js @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 "use strict"; | |
2 process.stdin.setEncoding("utf8"); | |
3 var incoming = ""; | |
4 var firstInput = true; | |
5 var context = {}; | |
6 | |
7 process.stdin.on("data", function(chunk) { | |
8 incoming += chunk; | |
9 var i = incoming.indexOf("\n"); | |
10 while (i > -1) { | |
11 try{ | |
12 var input = incoming.substr(0, i); | |
13 incoming = incoming.substr(i+1); | |
14 var fn = JSON.parse(input); | |
15 if(firstInput){ | |
16 context = require("vm").runInNewContext(fn, {}); | |
17 } | |
18 else{ | |
19 process.stdout.write(JSON.stringify(require("vm").runInNewContext(fn, context)) + "\n"); | |
20 } | |
21 } | |
22 catch(e){ | |
23 console.error(e); | |
24 } | |
25 if(firstInput){ | |
26 firstInput = false; | |
27 } | |
28 else{ | |
29 /*strings to indicate the process has finished*/ | |
30 console.log("r1cepzbhUTxtykz5XTC4"); | |
31 console.error("r1cepzbhUTxtykz5XTC4"); | |
32 } | |
33 | |
34 i = incoming.indexOf("\n"); | |
35 } | |
36 }); | |
37 process.stdin.on("end", process.exit); |