Skip to content

Commit

Permalink
Do not fail if niceness syscall is blocked (coder#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoog authored Oct 24, 2020
1 parent 894ab67 commit ba96bbc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions localexec_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ func (l LocalExecer) Start(ctx context.Context, c Command) (Process, error) {
if l.ChildProcessPriority != nil {
pid := process.cmd.Process.Pid
niceness := *l.ChildProcessPriority
err := syscall.Setpriority(syscall.PRIO_PROCESS, pid, niceness)
if err != nil {
return nil, xerrors.Errorf("set process (pid: %d) priority to (niceness: %d): %w", pid, niceness, err)
}

// the environment may block the niceness syscall
_ = syscall.Setpriority(syscall.PRIO_PROCESS, pid, niceness)
}

return &process, nil
Expand Down

0 comments on commit ba96bbc

Please sign in to comment.