Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/cwlNodeEngineJSConsole.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 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); |
