Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1009090 - backtickToConsole - run external process and print its output to Java console; blocks until done

JavaX fragment (include)

// returns file with program output (STDOUT+STDERR)
static File backtickToConsole(S cmd) {
  ping();
  File outputFile = createTempFile(cmd, ".out");
  makeEmptyFile(outputFile); // unnecessary?
  TailFile tail = tailFile2(outputFile, 1000, f printNoNewLine_fix);
  
  // make a dependent child process that is exited when we exit
  print("Running: " + cmd);
  pcall {
    backtickToFile(cmd, outputFile);
  }
  tail.stop();
  ret outputFile;
}

Author comment

Began life as a copy of #1006739

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1009090
Snippet name: backtickToConsole - run external process and print its output to Java console; blocks until done
Eternal ID of this version: #1009090/10
Text MD5: d2a0432bee5a54f88090ff5b3d94de7b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-09 22:21:03
Source code size: 458 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 369 / 401
Version history: 9 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1009090 & http://1009090.tinybrain.de