mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-04-19 12:57:17 +00:00
fix: do not start obsolete daemon watcher process
Before arduino/arduino-cli#488, IDE2 required a way to stop the daemon process if the parent (backend) process crashed. However, this mechanism is no longer necessary as the CLI daemon process is not actually a true daemon process. Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
2aae9e0a07
commit
57fa18b940
@ -10,7 +10,6 @@ import {
|
||||
} from '@theia/core/lib/common/disposable';
|
||||
import { Event, Emitter } from '@theia/core/lib/common/event';
|
||||
import { deepClone } from '@theia/core/lib/common/objects';
|
||||
import { environment } from '@theia/application-package/lib/environment';
|
||||
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
||||
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
|
||||
import { ArduinoDaemon, NotificationServiceServer } from '../common/protocol';
|
||||
@ -71,22 +70,6 @@ export class ArduinoDaemonImpl
|
||||
const cliPath = this.getExecPath();
|
||||
this.onData(`Starting daemon from ${cliPath}...`);
|
||||
const { daemon, port } = await this.spawnDaemonProcess();
|
||||
// Watchdog process for terminating the daemon process when the backend app terminates.
|
||||
spawn(
|
||||
process.execPath,
|
||||
[
|
||||
join(__dirname, 'daemon-watcher.js'),
|
||||
String(process.pid),
|
||||
String(daemon.pid),
|
||||
],
|
||||
{
|
||||
env: environment.electron.runAsNodeEnv(),
|
||||
detached: true,
|
||||
stdio: 'ignore',
|
||||
windowsHide: true,
|
||||
}
|
||||
).unref();
|
||||
|
||||
this.toDispose.pushAll([
|
||||
Disposable.create(() => {
|
||||
if (daemon.pid) {
|
||||
|
@ -1,22 +0,0 @@
|
||||
import psTree from 'ps-tree';
|
||||
import kill from 'tree-kill';
|
||||
const [theiaPid, daemonPid] = process.argv
|
||||
.slice(2)
|
||||
.map((id) => Number.parseInt(id, 10));
|
||||
|
||||
setInterval(() => {
|
||||
try {
|
||||
// Throws an exception if the Theia process doesn't exist anymore.
|
||||
process.kill(theiaPid, 0);
|
||||
} catch {
|
||||
psTree(daemonPid, function (_, children) {
|
||||
for (const { PID } of children) {
|
||||
const parsedPid = Number.parseInt(PID, 10);
|
||||
if (!Number.isNaN(parsedPid)) {
|
||||
kill(parsedPid);
|
||||
}
|
||||
}
|
||||
kill(daemonPid, () => process.exit());
|
||||
});
|
||||
}
|
||||
}, 1000);
|
Loading…
x
Reference in New Issue
Block a user