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)

1  
static int backtickToConsole_returnExitCode(S cmd) {
2  
  File outputFile = createTempFile(cmd, ".out");
3  
  makeEmptyFile(outputFile); // unnecessary?
4  
  TailFile tail = tailFile2(outputFile, 1000, f printNoNewLine_fix);
5  
  
6  
  // make a dependent child process that is exited when we exit
7  
  print("Running: " + cmd);
8  
  int exitCode = -1;
9  
  pcall {
10  
    exitCode = backtickToFile(cmd, outputFile).exitValue();
11  
  }
12  
  tail.stop();
13  
  ret exitCode;
14  
}

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: 452 / 520
Version history: 2 change(s)
Referenced in: [show references]