|
@@ -30,8 +30,8 @@ import java.util.Map;
|
|
|
import java.util.Scanner;
|
|
|
import java.util.prefs.Preferences;
|
|
|
import javax.swing.*;
|
|
|
-import net.rubygrapefruit.platform.Native;
|
|
|
-import net.rubygrapefruit.platform.ProcessLauncher;
|
|
|
+//import net.rubygrapefruit.platform.Native;
|
|
|
+//import net.rubygrapefruit.platform.ProcessLauncher;
|
|
|
import org.apache.commons.exec.CommandLine;
|
|
|
import org.apache.commons.exec.DefaultExecutor;
|
|
|
import org.apache.commons.exec.Executor;
|
|
@@ -1361,15 +1361,31 @@ public class Tools
|
|
|
return runCmdStreamable(txf,new PrintStream(new NullOutputStream()),false, cmd);
|
|
|
}
|
|
|
|
|
|
+ public static boolean runCmdWithOutToTextField(JTextArea txf, ProcessWatcher w,String... cmd)
|
|
|
+ {
|
|
|
+ return runCmdStreamable(txf,new PrintStream(new NullOutputStream()),false,w, cmd);
|
|
|
+ }
|
|
|
+
|
|
|
public static boolean runCmdWithPassthru(PrintStream p,String... cmd)
|
|
|
{
|
|
|
return runCmdStreamable(new JTextArea(),p,false, cmd);
|
|
|
}
|
|
|
|
|
|
+ public static boolean runCmdWithPassthru(PrintStream p,ProcessWatcher w,String... cmd)
|
|
|
+ {
|
|
|
+ return runCmdStreamable(new JTextArea(),p,false,w, cmd);
|
|
|
+ }
|
|
|
+
|
|
|
//private static ExecuteStreamHandler s;
|
|
|
//private static JTextArea txf;
|
|
|
//private static PrintStream otherOut;
|
|
|
- public static boolean runCmdStreamable(JTextArea txf,PrintStream otherOut,final boolean SpamException, String... cmd)//synchronized gint nen fetten Bug
|
|
|
+ public static boolean runCmdStreamable(JTextArea txf,PrintStream otherOut,final boolean SpamException, String... cmd)
|
|
|
+ {
|
|
|
+ return runCmdStreamable(txf, otherOut, SpamException, null, cmd);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static boolean runCmdStreamable(JTextArea txf,PrintStream otherOut,final boolean SpamException,ProcessWatcher w, String... cmd)//synchronized gint nen fetten Bug
|
|
|
{
|
|
|
try //synchronized gint nen fetten Bug
|
|
|
{
|
|
@@ -1393,8 +1409,12 @@ public class Tools
|
|
|
|
|
|
ProcessBuilder pb = new ProcessBuilder(Arrays.asList(cmd));
|
|
|
pb.redirectErrorStream(true);
|
|
|
- ProcessLauncher l = Native.get(ProcessLauncher.class);
|
|
|
- Process process = l.start(pb);
|
|
|
+ //ProcessLauncher l = Native.get(ProcessLauncher.class);
|
|
|
+ Process process = pb.start();
|
|
|
+ if(w!=null)
|
|
|
+ {
|
|
|
+ w.receiveProcess(process);
|
|
|
+ }
|
|
|
PrintStream stdout = new PrintStreamCapturer(txf, otherOut);
|
|
|
Thread stdoutThread = new Thread(new TextDumper(process.getInputStream(), stdout));
|
|
|
stdoutThread.start();
|
|
@@ -1404,7 +1424,7 @@ public class Tools
|
|
|
return result!=0;
|
|
|
//sil=false;
|
|
|
}
|
|
|
- catch (InterruptedException ex)
|
|
|
+ catch (InterruptedException|IOException ex)
|
|
|
{
|
|
|
ex.printStackTrace();
|
|
|
}
|