[PC-BSD Commits] r17445 - pcbsd/current/src-qt4/pc-controlpanel

svn at pcbsd.org svn at pcbsd.org
Tue Jun 26 04:24:49 PDT 2012


Author: yurkis
Date: 2012-06-26 11:24:46 +0000 (Tue, 26 Jun 2012)
New Revision: 17445

Modified:
   pcbsd/current/src-qt4/pc-controlpanel/item.cpp
Log:
Reworked PC-Trycommand handling. It may fix g=freeze (now we have timeout on shell command execution)
Please test

Modified: pcbsd/current/src-qt4/pc-controlpanel/item.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-controlpanel/item.cpp	2012-06-26 09:17:48 UTC (rev 17444)
+++ pcbsd/current/src-qt4/pc-controlpanel/item.cpp	2012-06-26 11:24:46 UTC (rev 17445)
@@ -39,6 +39,8 @@
 
 #include "../config.h"
 
+#include <iostream>
+
 const char* const PBI_NAME_FIELD = "PC-PBIName";
 const char* const TRY_MESSAGE_FIELD = "PC-TryMessage";
 const char* const TRY_COMMAND_FIELD = "PC-TryCommand";
@@ -146,10 +148,29 @@
     Str= Reader.value(TRY_COMMAND_FIELD).toString();
     if (Str.length())
     {
+        QTemporaryFile tmpFile;
+        if (!tmpFile.open())
+        {
+            return false;
+        }
+        QTextStream out(&tmpFile);
+        out<<Str<<"\n";
+        out.flush();
+        tmpFile.flush();
+
+        QProcess shell_proc;
+        shell_proc.start("/bin/sh",QStringList()<<tmpFile.fileName());
+        shell_proc.waitForFinished(7000);
+        if (shell_proc.exitCode())
+            return false;
+    }
+    /*if (Str.length())
+    {
         if (system(Str.toLatin1()) != 0)
             return false;
-    }
+    }*/
 
+
     mOriginalName = Reader.value("Name").toString();
     if (!mOriginalName.length())
     {



More information about the Commits mailing list