File tree 1 file changed +6
-13
lines changed
1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -238,24 +238,21 @@ func (disc *Client) runProcess() error {
238
238
return nil
239
239
}
240
240
241
- func (disc * Client ) killProcess () error {
241
+ func (disc * Client ) killProcess () {
242
242
disc .statusMutex .Lock ()
243
243
defer disc .statusMutex .Unlock ()
244
244
245
245
disc .logger .Infof ("Killing discovery process" )
246
- if disc .process != nil {
247
- if err := disc .process .Kill (); err != nil {
246
+ if process := disc .process ; process != nil {
247
+ disc .process = nil
248
+ if err := process .Kill (); err != nil {
248
249
disc .logger .Errorf ("Killing discovery process: %v" , err )
249
- return err
250
250
}
251
- if err := disc . process .Wait (); err != nil {
251
+ if err := process .Wait (); err != nil {
252
252
disc .logger .Errorf ("Waiting discovery process termination: %v" , err )
253
- return err
254
253
}
255
- disc .process = nil
256
254
}
257
255
disc .logger .Infof ("Discovery process killed" )
258
- return nil
259
256
}
260
257
261
258
// Run starts the discovery executable process and sends the HELLO command to the discovery to agree on the
@@ -273,11 +270,7 @@ func (disc *Client) Run() (err error) {
273
270
if err == nil {
274
271
return
275
272
}
276
- if err := disc .killProcess (); err != nil {
277
- // Log failure to kill the process, ideally that should never happen
278
- // but it's best to know it if it does
279
- disc .logger .Errorf ("Killing discovery after unsuccessful start: %s" , err )
280
- }
273
+ disc .killProcess ()
281
274
}()
282
275
283
276
if err = disc .sendCommand ("HELLO 1 \" arduino-cli " + disc .userAgent + "\" \n " ); err != nil {
You can’t perform that action at this time.
0 commit comments