Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/cwltool/cwlNodeEngineJSConsole.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 function js_console_log(){ | |
3 console.error("[log] "+require("util").format.apply(this, arguments).split("\n").join("\n[log] ")); | |
4 } | |
5 function js_console_err(){ | |
6 console.error("[err] "+require("util").format.apply(this, arguments).split("\n").join("\n[err] ")); | |
7 } | |
8 process.stdin.setEncoding("utf8"); | |
9 var incoming = ""; | |
10 process.stdin.on("data", function(chunk) { | |
11 incoming += chunk; | |
12 var i = incoming.indexOf("\n"); | |
13 if (i > -1) { | |
14 try{ | |
15 var fn = JSON.parse(incoming.substr(0, i)); | |
16 incoming = incoming.substr(i+1); | |
17 process.stdout.write(JSON.stringify(require("vm").runInNewContext(fn, { | |
18 console: { | |
19 log: js_console_log, | |
20 error: js_console_err | |
21 } | |
22 })) + "\n"); | |
23 } | |
24 catch(e){ | |
25 console.error(e) | |
26 } | |
27 /*strings to indicate the process has finished*/ | |
28 console.log("r1cepzbhUTxtykz5XTC4"); | |
29 console.error("r1cepzbhUTxtykz5XTC4"); | |
30 } | |
31 }); | |
32 process.stdin.on("end", process.exit); |