Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: execute the Arduino CLI without a shell #2182

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions arduino-ide-extension/src/node/arduino-daemon-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -173,10 +156,9 @@ export class ArduinoDaemonImpl
const cliPath = this.getExecPath();
const ready = new Deferred<{ daemon: ChildProcess; port: string }>();
const options = {
shell: true,
env: { ...deepClone(process.env), NO_COLOR: String(true) },
};
const daemon = spawn(`"${cliPath}"`, args, options);
const daemon = spawn(cliPath, args, options);

// If the process exists right after the daemon gRPC server has started (due to an invalid port, unknown address, TCP port in use, etc.)
// we have no idea about the root cause unless we sniff into the first data package and dispatch the logic on that. Note, we get a exit code 1.
Expand Down
22 changes: 0 additions & 22 deletions arduino-ide-extension/src/node/daemon-watcher.ts

This file was deleted.