Uses 107K of libraries. Click here for Pure Java version (8456L/48K).
1 | lib 1013692 |
2 | |
3 | sS apacheCommonsExec(LS args) ctex { |
4 | var cmdLine = new org.apache.commons.exec.CommandLine(first(args)); |
5 | for (arg : dropFirst(args)) |
6 | cmdLine.addArgument(arg); |
7 | ret apacheCommonsExec(cmdLine); |
8 | } |
9 | |
10 | sS apacheCommonsExec(S cmd) { |
11 | ret apacheCommonsExec(org.apache.commons.exec.CommandLine.parse(cmd)); |
12 | } |
13 | |
14 | sS apacheCommonsExec(org.apache.commons.exec.CommandLine cmdLine) ctex { |
15 | delegate DefaultExecutor, PumpStreamHandler to org.apache.commons.exec. |
16 | |
17 | new DefaultExecutor executor; |
18 | new ByteArrayOutputStream baos; |
19 | OutputStream stream = teeOutputStream(printOutputStream(), baos); |
20 | PumpStreamHandler pump = new(stream, stream); |
21 | executor.setStreamHandler(pump); |
22 | print("Exit value: " + executor.execute(cmdLine)); |
23 | ret fromUTF8(toByteArray(baos)); |
24 | } |
Began life as a copy of #1006739
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035472 |
Snippet name: | apacheCommonsExec |
Eternal ID of this version: | #1035472/7 |
Text MD5: | 8670eaa17b69b967f3013d1461ce5097 |
Transpilation MD5: | 79a0f2437084dc504130422a1cfcd5c5 |
Author: | stefan |
Category: | javax / os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-22 19:15:14 |
Source code size: | 802 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 120 / 192 |
Version history: | 6 change(s) |
Referenced in: | [show references] |