Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/cwltool/cwlNodeEngineJSConsole.js @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
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); |