comparison env/lib/python3.7/site-packages/cwltool/cwlNodeEngineWithContext.js @ 5:9b1c78e6ba9c draft default tip

"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author shellac
date Mon, 01 Jun 2020 08:59:25 -0400
parents 79f47841a781
children
comparison
equal deleted inserted replaced
4:79f47841a781 5:9b1c78e6ba9c
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);