Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/cwltool/cwlNodeEngineWithContext.js @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:18:57 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d30785e31577 |
---|---|
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); |