From 88129448ed984d86fb8fd9f431e7a6228e59ca4d Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Thu, 22 Feb 2024 21:22:38 +0100 Subject: [PATCH] fix: runner startup silent failure (#914) Closes #909 ### Summary of Changes - failing to start runner process now logs an appropriate message informs the user via popup again - command is now successfully passed to the runner component, if changed --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> --- .../safe-ds-lang/src/language/runner/safe-ds-runner.ts | 9 +++++++-- packages/safe-ds-vscode/src/extension/mainClient.ts | 3 +++ 2 files changed, 10 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..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 @@ -104,8 +104,10 @@ 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 +416,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..a7fb4976a 100644 --- a/packages/safe-ds-vscode/src/extension/mainClient.ts +++ b/packages/safe-ds-vscode/src/extension/mainClient.ts @@ -382,6 +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')!, + ); if (!services.runtime.Runner.isPythonServerAvailable()) { services.runtime.Runner.startPythonServer(); } else {