]> git.lyx.org Git - features.git/blob - src/support/syscall.C
We don't currently use fork anywhere (or if we do it's by mistake!), so
[features.git] / src / support / syscall.C
1 /**
2  *  \file syscall.C
3  *  Copyright 2002 the LyX Team
4  *  Read the file COPYING
5  *
6  * \author Asger Alstrup
7  *
8  * Interface cleaned up by
9  * \author Angus Leeming <a.leeming@ic.ac.uk>
10  *
11  * Class Systemcalls uses "system" to launch the child process.
12  * The user can choose to wait or not wait for the process to complete, but no
13  * callback is invoked upon completion of the child.
14  *
15  * The child process is not killed when the Systemcall instance goes out of
16  * scope.
17  */
18
19 #include <config.h>
20
21 #ifdef __GNUG__
22 #pragma implementation
23 #endif
24
25 #include "syscall.h"
26 #include "os.h"
27
28 Systemcalls::Systemcalls(Starttype how, string const & what)
29 {
30         startscript(how, what);
31 }
32
33
34 // Reuse of instance
35 int Systemcalls::startscript(Starttype how, string const & what)
36 {
37         string command = what;
38
39         if (how == DontWait) {
40                 if (os::shell() == os::UNIX) {
41                         command += " &";
42                 } else {
43                         command = "start /min/n " + command;
44                 }
45         }
46
47         return ::system(command.c_str());
48 }