Uses 107K of libraries. Click here for Pure Java version (15646L/112K).
!7 sclass Backtick extends DynPrintLog { S cmd; S method = "Stefan's method"; transient JButton btnGo; JComponent visualize() { ret northAndCenter( vstackWithSpacing( centerAndEastWithMargins( withLabel("Command:", onEnter(jLiveValueTextField_bothWays(dm_fieldLiveValue('cmd)), r go)), btnGo = jbutton("Go", r go)), withRightMargin(jrightAlignedLine(withLabel("Method:", jLiveValueComboBox(ll("Stefan's method", "Apache Commons Exec"), dm_fieldLiveValue('method)))))), super.visualize()); } void go() { pcall-short { temp enter(); temp tempDisableButton(btnGo); clearPrintLog(); S cmd = this.cmd; print("Running command with " + method + ": " + cmd + "\n"); int exitValue; if (eq(method, "Apache Commons Exec")) { OutputStream stream1 = printOutputStreamWithIndent(" "); OutputStream stream2 = printOutputStreamWithIndent(" "); exitValue = apacheCommonsExec_backtickToStreams(cmd, stream1, stream2); // print empty lines & flush stdout & stderr stream1.write(toUtf8("\n")); stream2.write(toUtf8("\n")); } else { LineBuffer buf = lineBuffer_printWithIndent(" "); backtickToReceiver(cmd, vfAppendToLineBuffer(buf)); exitValue = backtick_exitValue; print(); } print("Exit value: " + exitValue); } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016732 |
Snippet name: | Backtick - run system command [Dyn Module] |
Eternal ID of this version: | #1016732/12 |
Text MD5: | ae02b80452bd2cbb9b361c52b4acebb1 |
Transpilation MD5: | 462e599f22cd07a35363343c283072e2 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-30 17:15:23 |
Source code size: | 1504 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 390 / 649 |
Version history: | 11 change(s) |
Referenced in: | [show references] |