1 | // returns file with program output (STDOUT+STDERR) |
2 | static File backtickToConsoleX(S cmd, fO outputReceiver) { |
3 | File outputFile = createTempFile(cmd, ".out"); |
4 | makeEmptyFile(outputFile); // unnecessary? |
5 | TailFile tail = tailFile2(outputFile, 1000, voidfunc(S s) { |
6 | printNoNewLine(fixNewLines(s)); |
7 | pcallF(outputReceiver, s); |
8 | }); |
9 | |
10 | // make a dependent child process that is exited when we exit |
11 | print("Running: " + cmd); |
12 | pcall { |
13 | backtickToFile(cmd, outputFile); |
14 | } |
15 | tail.stop(); |
16 | ret outputFile; |
17 | } |
Began life as a copy of #1009090
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009098 |
Snippet name: | backtickToConsoleX - run external process, print its output to Java console and call function on output |
Eternal ID of this version: | #1009098/3 |
Text MD5: | 24f8e75b05758f4b1ffeed550bca4eac |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-30 16:53:03 |
Source code size: | 536 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 519 / 561 |
Version history: | 2 change(s) |
Referenced in: | [show references] |