2002-02-16 12:39:47 +00:00
|
|
|
/**
|
|
|
|
* \file syscall.C
|
|
|
|
* Copyright 2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Asger Alstrup
|
|
|
|
*
|
|
|
|
* Interface cleaned up by
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*
|
|
|
|
* Class Systemcalls uses "system" to launch the child process.
|
|
|
|
* The user can choose to wait or not wait for the process to complete, but no
|
|
|
|
* callback is invoked upon completion of the child.
|
|
|
|
*
|
|
|
|
* The child process is not killed when the Systemcall instance goes out of
|
|
|
|
* scope.
|
|
|
|
*/
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "syscall.h"
|
2002-02-16 12:39:47 +00:00
|
|
|
#include "os.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-02-16 18:34:30 +00:00
|
|
|
|
|
|
|
#if 0
|
2002-02-16 12:39:47 +00:00
|
|
|
Systemcalls::Systemcalls(Starttype how, string const & what)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2002-02-16 12:39:47 +00:00
|
|
|
startscript(how, what);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2002-02-16 18:34:30 +00:00
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Reuse of instance
|
2002-02-16 12:39:47 +00:00
|
|
|
int Systemcalls::startscript(Starttype how, string const & what)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2002-02-16 12:39:47 +00:00
|
|
|
string command = what;
|
2000-09-05 13:16:19 +00:00
|
|
|
|
2002-02-16 12:39:47 +00:00
|
|
|
if (how == DontWait) {
|
2001-06-27 14:10:35 +00:00
|
|
|
if (os::shell() == os::UNIX) {
|
|
|
|
command += " &";
|
|
|
|
} else {
|
|
|
|
command = "start /min/n " + command;
|
|
|
|
}
|
2000-09-05 13:16:19 +00:00
|
|
|
}
|
|
|
|
|
2002-02-16 12:39:47 +00:00
|
|
|
return ::system(command.c_str());
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|