Lutz wrote:In the next version an addtional "process creation flags" -parameter can be used on Windows versions of newLISP.
My problem was not wrong parameters, but the return value. What is the "pid" returned, and how can one use it? In Linux, it can be passed to
wait-pid, but in Win32 there is no such function, and
WaitForSingleObject system call accepts process handle instead. My example was written with the single goal to obtain this process handle.
Lutz wrote:While coding this, the following details in run-and-wait.lsp caught my attention: Shouldn't the size for STARTUPINFO si be 72? I believe the total structure size including the si.cb field should be taken? In any case having it bigger probably doesn't make a difference;si. cb now as sizeof(STARTUPINFO).
sizeof(STARTUPINFO) is 68 on my system, and
(pack "ld n64" 68) seems to be 68 bytes in total (4 bytes for si.cb and 64 zeros).
Code: Select all
#include <stdio.h>
#include <windows.h>
int main(void)
{
printf("%d\n", sizeof(STARTUPINFO));
}
Have I miscalculated something?
Lutz wrote:As flags you specify 32 or 0x00000020 for dwCreationFlags, couldn't find that flag on this page:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
but found 0x00000200 (512) for CREATE_NEW_PROCESS_GROUP. If this is what you meant, we could take this as the default value or just leave it as zero.
I have modeled my code after
this example, and 32 was intended to mean NORMAL_PRIORITY_CLASS. But now I see (from
this msdn page) that this is the default, and yes, therefore this parameter may be safely replaced to zero. Thanks, I'll do this (for the sake of simplicity).
Lutz wrote:ps: also on my system XP running in VirtualBox on Mac OS X, there is no difference running the old or new '!' function, althoigh others are observing this. No additional command shell, except for the one running the calling newLISP instance, is created no matter what function or flags.
I do close the initial command shell (by standard trick of using
FreeConsole imported from
kernel32) at the very first lines of my script, and then
! re-creates it. Try this example:
Code: Select all
(import "kernel32" "FreeConsole")
(FreeConsole)
(sleep 5000) ; no console window while sleeping
(! "notepad.exe") ; two windows are created: cmd.exe and notepad.exe
(exit)
This is the problem I try to avoid.