浏览代码

fix due to a ARM incompatibility && added a way for calling programs to
get access to the Process object so they can abort it

LH 10 年之前
父节点
当前提交
a5b39393eb

+ 15 - 0
ToolKit/src/main/java/de/nplusc/izc/tools/baseTools/ProcessWatcher.java

@@ -0,0 +1,15 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.nplusc.izc.tools.baseTools;
+
+/**
+ *
+ * @author tgoerner
+ */
+public interface ProcessWatcher
+{
+    public void receiveProcess(Process p);
+}

+ 26 - 6
ToolKit/src/main/java/de/nplusc/izc/tools/baseTools/Tools.java

@@ -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();
         }

+ 0 - 2
iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java

@@ -124,8 +124,6 @@ public class Main extends javax.swing.JFrame
     
     public static void setupLogging(boolean verbose)
     {
-        
-        
         //if(!cl.hasOption("verbose")&&!(System.getProperty("log4j.configurationFile")==null))
         //{
         //    System.setProperty("log4j.configurationFile", "file:///"+jarschiv+"!log4j2NonVerbose.xml");

+ 1 - 0
vlcj

@@ -0,0 +1 @@
+Subproject commit 00329ae60cfe281494231ac11cb4907f4a412cab