Mercurial > hg > octave-lyh
diff src/toplev.cc @ 6222:07d967f75dba
[project @ 2007-01-03 20:15:15 by jwe]
author | jwe |
---|---|
date | Wed, 03 Jan 2007 20:15:16 +0000 |
parents | 58f46c6f0d51 |
children | d42abdfcb8e9 |
line wrap: on
line diff
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -542,6 +542,7 @@ { if (type == et_async) { + // FIXME -- maybe this should go in sysdep.cc? #ifdef HAVE_FORK pid_t pid = fork (); @@ -559,6 +560,22 @@ } else retval(0) = pid; +#elif defined (__WIN32__) + STARTUPINFO si; + PROCESS_INFORMATION pi; + ZeroMemory (&si, sizeof (si)); + ZeroMemory (&pi, sizeof (pi)); + OCTAVE_LOCAL_BUFFER (char, xcmd_str, cmd_str.length()+1); + strcpy (xcmd_str, cmd_str.c_str ()) + + if (! CreateProcess (0, xcmd_str, 0, 0, FALSE, 0, 0, 0, &si, &pi)) + error ("system: CreateProcess failed -- can't create child process"); + else + { + retval(0) = pi.dwProcessId; + CloseHandle (pi.hProcess); + CloseHandle (pi.hThread); + } #else error ("asynchronous system calls are not supported"); #endif