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)

1  
// returns file with program output (STDOUT+STDERR)
2  
static File backtickToConsole(S cmd) {
3  
  ping();
4  
  File outputFile = createTempFile(cmd, ".out");
5  
  makeEmptyFile(outputFile); // unnecessary?
6  
  TailFile tail = tailFile2(outputFile, 1000, l1 printNoNewLine_fix);
7  
  
8  
  // make a dependent child process that is exited when we exit
9  
  print("Running: " + cmd);
10  
  pcall {
11  
    backtickToFile(cmd, outputFile);
12  
  }
13  
  tail.stop();
14  
  ret outputFile;
15  
}

Author comment

Began life as a copy of #1006739

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, 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/11
Text MD5: 926f2f7eb474c0878c0803f8e4c71ee4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-03 21:32:17
Source code size: 459 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 595 / 653
Version history: 10 change(s)
Referenced in: [show references]