!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); } } }