When I add an already-running app to a job at job-creation time, that already-running app gets a handle to the job object.
I fooled with AssignProcessToJobObject() a bit and I could not make that happen! How does it happen? Can you stop it from happening? It messes up using /K to make processes in job objects terminate along with the process that created the job.
v:\> echo Host PID is %_PID Host PID is 4248 v:\> jobs /n=job1 /k 2296 v:\> handle -a | egrep "tcc.*pid|job" tcc.exe pid: 4248 zz\vefatica 2B4: Job \Sessions\2\BaseNamedObjects\job1 tcc.exe pid: 2296 zz\vefatica 1FC: Job \Sessions\2\BaseNamedObjects\job1 v:\>