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

14
LINES

< > BotCompany Repo | #1009576 // backtickToConsole_lineBuf - run external process, print its output to Java console and call function on output lines

JavaX fragment (include)

1  
// returns file with program output (STDOUT+STDERR)
2  
static File backtickToConsole_lineBuf(S cmd, fO onLine) {
3  
  O onOutput = new O {
4  
    new LinesBuffer buf;
5  
6  
    void get(S s) {
7  
      buf.append(fixNewLines(s));
8  
      for (S line : buf.getAndClearCompleteLines())
9  
        pcallF(onLine, line);
10  
    }
11  
  };
12  
  
13  
  ret backtickToConsoleX(cmd, onOutput);
14  
}

Author comment

Began life as a copy of #1009098

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: #1009576
Snippet name: backtickToConsole_lineBuf - run external process, print its output to Java console and call function on output lines
Eternal ID of this version: #1009576/4
Text MD5: bd141fb85c881a825720d2ba48014f44
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-08 21:40:14
Source code size: 364 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 405
Version history: 3 change(s)
Referenced in: [show references]