* 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/os.h"
+#include "support/SystemcallPrivate.h"
+#include "support/ProgressInterface.h"
-#include <cstdlib>
+namespace lyx {
+namespace support {
-using std::string;
+static ProgressInterface* progress_impl = 0;
-#ifndef CXX_GLOBAL_CSTD
-using std::system;
-#endif
-namespace lyx {
-namespace support {
+void Systemcall::registerProgressInterface(ProgressInterface* p)
+{
+ progress_impl = p;
+}
-// Reuse of instance
-int Systemcall::startscript(Starttype how, string const & what)
+
+ProgressInterface* Systemcall::progress()
+{
+ return progress_impl;
+}
+
+
+int Systemcall::startscript(Starttype how, std::string const & what)
{
- 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());
+ // TODO Reuse of instance?
+ SystemcallPrivate* process = new SystemcallPrivate;
+ if (how == Wait)
+ return process->start(what, true);
+ return process->start(what, false);
}
+
} // namespace support
} // namespace lyx