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

14
LINES

< > BotCompany Repo | #1009101 // backtickToConsole_returnExitCode - run external process and print its output to Java console

JavaX fragment (include)

static int backtickToConsole_returnExitCode(S cmd) {
  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);
  int exitCode = -1;
  pcall {
    exitCode = backtickToFile(cmd, outputFile).exitValue();
  }
  tail.stop();
  ret exitCode;
}

Author comment

Began life as a copy of #1009090

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009101
Snippet name: backtickToConsole_returnExitCode - run external process and print its output to Java console
Eternal ID of this version: #1009101/3
Text MD5: 37fea710f066017ce04b2b5e70e083e6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-02 19:15:02
Source code size: 451 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 382 / 446
Version history: 2 change(s)
Referenced in: [show references]