diff --git a/internal/jobobject/jobobject.go b/internal/jobobject/jobobject.go index 2e5ad11684..52333986dd 100644 --- a/internal/jobobject/jobobject.go +++ b/internal/jobobject/jobobject.go @@ -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,