Is there a way to spawn a process that won't be a child process,
because I can't seem to kill any processes created with
spawnProcess() It keeps giving me access denied for the processes
and it's necessary for me to kill a process, compile it and then
spawn it again.
Currently what I do is save the pid of the spawned process and
then call kill() using that pid then calling dmd which compiles
it again, but after first compilation and spawning of the process
I cannot do it again unless I restart the process that's handling
the compilation etc. so I would like to have the process that
updates to be a seperate process from the compiled process.
This is my code.
void end() {
if (lastPid)
kill(lastPid);
}
void clear() {
if (exists(processFolder)) {
foreach (string name;
dirEntries(processFolder, SpanMode.depth)) {
remove(name);
}
rmdir(processFolder);
}
}
void compile() {
if (lastPid)
end();
clear();
string[] cmd = ["dmd.exe", "-of" ~ processFile, "-m32"];
foreach (string e; dirEntries(srcFolder, SpanMode.depth))
cmd ~= e;
auto pid = spawnProcess(cmd);
wait(pid);
lastPid = spawnProcess(processFile);
}
Then I call compile() for everytime I need to update.
I have been looking through various code in the documents and
google etc. but I cannot seem to achieve what I want. Is there no
simple way to create a process that isn't associated with any
processes using spawnProcess?