From 7d23787dc962894afcb0807655595c37fb6491d1 Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Thu, 22 Feb 2024 20:27:25 +0100 Subject: [PATCH 1/2] fix: failing to start runner process now logs an appropriate message and informs the user via popup again + command is now successfully passed to the runner component, if changed --- .../safe-ds-lang/src/language/runner/safe-ds-runner.ts | 7 +++++-- packages/safe-ds-vscode/src/extension/mainClient.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts b/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts index a2e35702f..65d866a3a 100644 --- a/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts +++ b/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts @@ -104,8 +104,8 @@ export class SafeDsRunner { this.logging.outputInfo(`Using safe-ds-runner version: ${versionString}`); } } catch (error) { - this.logging.outputError(`Could not start runner: ${error}`); - this.logging.displayError('The runner process could not be started.'); + this.logging.outputError(`Could not start runner: ${error instanceof Error ? error.message : error}`); + this.logging.displayError(`The runner process could not be started: ${error instanceof Error ? error.message : error}`); return; } // Start the runner at the specified port @@ -414,6 +414,9 @@ export class SafeDsRunner { process.on('close', (code) => { reject(new Error(`The subprocess shut down: ${code}`)); }); + process.on('error', (err) => { + reject(new Error(`The subprocess could not be started (${err.message})`)); + }); }); } diff --git a/packages/safe-ds-vscode/src/extension/mainClient.ts b/packages/safe-ds-vscode/src/extension/mainClient.ts index dbc95b964..09747bbfb 100644 --- a/packages/safe-ds-vscode/src/extension/mainClient.ts +++ b/packages/safe-ds-vscode/src/extension/mainClient.ts @@ -382,6 +382,7 @@ const registerVSCodeWatchers = function () { if (event.affectsConfiguration('safe-ds.runner.command')) { // Try starting runner logOutput('Safe-DS Runner Command was updated'); + services.runtime.Runner.updateRunnerCommand(vscode.workspace.getConfiguration('safe-ds.runner').get('command')!); if (!services.runtime.Runner.isPythonServerAvailable()) { services.runtime.Runner.startPythonServer(); } else { From d38002f51a4c6f5e451e3e4c04fffd16c3e1fa9f Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:30:32 +0000 Subject: [PATCH 2/2] style: apply automated linter fixes --- packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts | 4 +++- packages/safe-ds-vscode/src/extension/mainClient.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts b/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts index 65d866a3a..01065aa2c 100644 --- a/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts +++ b/packages/safe-ds-lang/src/language/runner/safe-ds-runner.ts @@ -105,7 +105,9 @@ export class SafeDsRunner { } } catch (error) { this.logging.outputError(`Could not start runner: ${error instanceof Error ? error.message : error}`); - this.logging.displayError(`The runner process could not be started: ${error instanceof Error ? error.message : error}`); + this.logging.displayError( + `The runner process could not be started: ${error instanceof Error ? error.message : error}`, + ); return; } // Start the runner at the specified port diff --git a/packages/safe-ds-vscode/src/extension/mainClient.ts b/packages/safe-ds-vscode/src/extension/mainClient.ts index 09747bbfb..a7fb4976a 100644 --- a/packages/safe-ds-vscode/src/extension/mainClient.ts +++ b/packages/safe-ds-vscode/src/extension/mainClient.ts @@ -382,7 +382,9 @@ const registerVSCodeWatchers = function () { if (event.affectsConfiguration('safe-ds.runner.command')) { // Try starting runner logOutput('Safe-DS Runner Command was updated'); - services.runtime.Runner.updateRunnerCommand(vscode.workspace.getConfiguration('safe-ds.runner').get('command')!); + services.runtime.Runner.updateRunnerCommand( + vscode.workspace.getConfiguration('safe-ds.runner').get('command')!, + ); if (!services.runtime.Runner.isPythonServerAvailable()) { services.runtime.Runner.startPythonServer(); } else {