@@ -69,18 +69,26 @@ func CLI() error {
69
69
70
70
err = unix .Setpriority (unix .PRIO_PROCESS , 0 , * nice )
71
71
if err != nil {
72
+ << << << < Updated upstream
72
73
// We alert the user instead of failing the command since it can be difficult to debug
73
74
// for a template admin otherwise. It's quite possible (and easy) to set an
74
75
// inappriopriate value for niceness.
75
76
printfStdErr ("failed to adjust niceness to %q: %v" , * nice , err )
77
+ == == == =
78
+ return xerrors .Errorf ("set nice score for cmd %v: %w" , args , err )
79
+ >> >> >> > Stashed changes
76
80
}
77
81
78
82
err = writeOOMScoreAdj (* oom )
79
83
if err != nil {
84
+ << << << < Updated upstream
80
85
// We alert the user instead of failing the command since it can be difficult to debug
81
86
// for a template admin otherwise. It's quite possible (and easy) to set an
82
87
// inappriopriate value for oom_score_adj.
83
88
printfStdErr ("failed to adjust oom score to %q: %v" , * nice , err )
89
+ == == == =
90
+ return xerrors .Errorf ("set oom score for cmd %v: %w" , args , err )
91
+ >> >> >> > Stashed changes
84
92
}
85
93
86
94
path , err := exec .LookPath (args [0 ])
@@ -138,7 +146,7 @@ func oomScoreAdj() (int, error) {
138
146
}
139
147
140
148
func writeOOMScoreAdj (score int ) error {
141
- return os .WriteFile ("/proc/self /oom_score_adj" , []byte (fmt .Sprintf ("%d" , score )), 0o600 )
149
+ return os .WriteFile (fmt . Sprintf ( "/proc/%d /oom_score_adj" , os . Getpid ()) , []byte (fmt .Sprintf ("%d" , score )), 0o600 )
142
150
}
143
151
144
152
// execArgs returns the arguments to pass to syscall.Exec after the "--" delimiter.
0 commit comments