Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
Check if there's running processes in the job object before promoting to
a silo

Signed-off-by: Daniel Canter <[email protected]>
  • Loading branch information
dcantah committed Mar 23, 2022
1 parent 1bbaa26 commit 3cfdf8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/jobobject/jobobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,16 @@ func (job *JobObject) PromoteToSilo() error {
return nil
}

_, err := windows.SetInformationJobObject(
pids, err := job.Pids()
if err != nil {
return err
}

if len(pids) != 0 {
return fmt.Errorf("job cannot have running processes to be promoted to a silo, found %d running processes", len(pids))
}

_, err = windows.SetInformationJobObject(
job.handle,
winapi.JobObjectCreateSilo,
0,
Expand Down

0 comments on commit 3cfdf8a

Please sign in to comment.