* 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