summaryrefslogtreecommitdiff
path: root/src/spawn.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-09-29 20:35:35 +0200
committerTannin <devnull@localhost>2014-09-29 20:35:35 +0200
commitbfa6c9ab1e2f316c53811de6e311212b8a088591 (patch)
tree1903fb7b8758ebacaa91497561ea5277d13f8d2b /src/spawn.cpp
parent7a7c464b18f2977c3a7aa7e80c4041732b19ba26 (diff)
- moved the hook-recursion-protection to tls
- some code cleanup and consolidation - hook.dll will now report all of its own exceptions - some more logging during startup - changed the way urls are encoded for download requests - now displaying (one of the) process name(s) while waiting for a program to end - bugfix: spawned processes were forced to leave the job
Diffstat (limited to 'src/spawn.cpp')
-rw-r--r--src/spawn.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/spawn.cpp b/src/spawn.cpp
index 1392ec88..64f4e995 100644
--- a/src/spawn.cpp
+++ b/src/spawn.cpp
@@ -117,6 +117,19 @@ HANDLE startBinary(const QFileInfo &binary,
HANDLE stdOut,
HANDLE stdErr)
{
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo;
+
+ ::QueryInformationJobObject(NULL, JobObjectExtendedLimitInformation, &jobInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION), NULL);
+ jobInfo.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_BREAKAWAY_OK;
+
+ HANDLE jobObject = ::CreateJobObject(NULL, NULL);
+
+ if (jobObject == NULL) {
+ qWarning("failed to create job object: %lu", ::GetLastError());
+ } else {
+ ::SetInformationJobObject(jobObject, JobObjectExtendedLimitInformation, &jobInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
+ }
+
HANDLE processHandle, threadHandle;
std::wstring binaryName = ToWString(QDir::toNativeSeparators(binary.absoluteFilePath()));
std::wstring currentDirectoryName = ToWString(QDir::toNativeSeparators(currentDirectory.absolutePath()));