* spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB

to c_flags only if current process is member of a job and breakaway
	is allowed.
This commit is contained in:
Corinna Vinschen 2011-12-22 14:33:08 +00:00
parent 964a927fe6
commit a4ea75600c
2 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-12-22 Corinna Vinschen <vinschen@redhat.com>
* spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
to c_flags only if current process is member of a job and breakaway
is allowed.
2011-12-22 Corinna Vinschen <vinschen@redhat.com> 2011-12-22 Corinna Vinschen <vinschen@redhat.com>
* external.cc (cygwin_internal): Implement CW_ALLOC_DRIVE_MAP, * external.cc (cygwin_internal): Implement CW_ALLOC_DRIVE_MAP,

View File

@ -452,6 +452,9 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
c_flags = GetPriorityClass (GetCurrentProcess ()); c_flags = GetPriorityClass (GetCurrentProcess ());
sigproc_printf ("priority class %d", c_flags); sigproc_printf ("priority class %d", c_flags);
c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT;
/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround issues /* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround issues
with the "Program Compatibility Assistant (PCA) Service" observed on with the "Program Compatibility Assistant (PCA) Service" observed on
Windows 7. For some reason, when starting long running sessions from Windows 7. For some reason, when starting long running sessions from
@ -461,8 +464,15 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
mintty session, or to stop the PCA service. However, a process which mintty session, or to stop the PCA service. However, a process which
is controlled by PCA is part of a compatibility job, which allows child is controlled by PCA is part of a compatibility job, which allows child
processes to break away from the job. This helps to avoid this issue. */ processes to break away from the job. This helps to avoid this issue. */
c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT JOBOBJECT_BASIC_LIMIT_INFORMATION jobinfo;
| CREATE_BREAKAWAY_FROM_JOB; if (QueryInformationJobObject (NULL, JobObjectBasicLimitInformation,
&jobinfo, sizeof jobinfo, NULL)
&& (jobinfo.LimitFlags & (JOB_OBJECT_LIMIT_BREAKAWAY_OK
| JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK)))
{
debug_printf ("Add CREATE_BREAKAWAY_FROM_JOB");
c_flags |= CREATE_BREAKAWAY_FROM_JOB;
}
if (mode == _P_DETACH) if (mode == _P_DETACH)
c_flags |= DETACHED_PROCESS; c_flags |= DETACHED_PROCESS;