]> git.lyx.org Git - lyx.git/blobdiff - src/support/Systemcall.cpp
abdel likes short code
[lyx.git] / src / support / Systemcall.cpp
index bf7192dd428f2e6742e7e03eb18b02ec7f71b10b..bfdf0690b313f410665f2c2b9a6d8e804c022d43 100644 (file)
@@ -4,7 +4,6 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Asger Alstrup
- * \author Peter Kümmel
  *
  * Interface cleaned up by
  * \author Angus Leeming
 #include <config.h>
 
 #include "support/Systemcall.h"
-#include "support/SystemcallPrivate.h"
-#include "support/ProgressInterface.h"
+#include "support/os.h"
 
-namespace lyx {
-namespace support {
-
-static ProgressInterface* progress_impl = 0;
-
-
-void Systemcall::registerProgressInterface(ProgressInterface* p)
-{
-       progress_impl = p;
-}
+#include <cstdlib>
 
+using namespace std;
 
-ProgressInterface* Systemcall::progress()
-{
-       return progress_impl;
-}
-
+namespace lyx {
+namespace support {
 
-int Systemcall::startscript(Starttype how, std::string const & what)
+// Reuse of instance
+int Systemcall::startscript(Starttype how, string const & what)
 {
-       // TODO Reuse of instance?
-       SystemcallPrivate* process = new SystemcallPrivate;
-       if (how == Wait)
-               return process->start(what, true);
-       return process->start(what, false);
+       string command = what;
+
+       if (how == DontWait) {
+               switch (os::shell()) {
+               case os::UNIX:
+                       command += " &";
+                       break;
+               case os::CMD_EXE:
+                       command = "start /min " + command;
+                       break;
+               }
+       }
+
+       return ::system(command.c_str());
 }
 
-
 } // namespace support
 } // namespace lyx