Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 808fbe4

Browse files
author
Akos Kitta
committed
fix: terminate the process tree when stopping the daemon
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent bd9f29c commit 808fbe4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎arduino-ide-extension/src/node/arduino-daemon-impl.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ArduinoDaemon, NotificationServiceServer } from '../common/protocol';
1616
import { CLI_CONFIG } from './cli-config';
1717
import { getExecPath } from './exec-util';
1818
import { SettingsReader } from './settings-reader';
19-
// import { ProcessUtils } from '@theia/core/lib/node/process-utils';
19+
import { ProcessUtils } from '@theia/core/lib/node/process-utils';
2020

2121
@injectable()
2222
export class ArduinoDaemonImpl
@@ -35,8 +35,8 @@ export class ArduinoDaemonImpl
3535
@inject(SettingsReader)
3636
private readonly settingsReader: SettingsReader;
3737

38-
// @inject(ProcessUtils)
39-
// private readonly processUtils: ProcessUtils;
38+
@inject(ProcessUtils)
39+
private readonly processUtils: ProcessUtils;
4040

4141
private readonly toDispose = new DisposableCollection();
4242
private readonly onDaemonStartedEmitter = new Emitter<string>();
@@ -89,8 +89,14 @@ export class ArduinoDaemonImpl
8989

9090
this.toDispose.pushAll([
9191
Disposable.create(() => {
92-
daemon.kill();
93-
this.fireDaemonStopped();
92+
if (daemon.pid) {
93+
this.processUtils.terminateProcessTree(daemon.pid);
94+
this.fireDaemonStopped();
95+
} else {
96+
throw new Error(
97+
'The CLI Daemon process does not have a PID. IDE2 could not stop the CLI daemon.'
98+
);
99+
}
94100
}),
95101
]);
96102
this.fireDaemonStarted(port);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /