From 4d78c85de2429d89a3cb1fd688ae5a3d7596310f Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 09:50:38 +0200 Subject: Fix VSCode cargo-watch functionality on Linux. As of #1079 the VSCode cargo-watch functionality has been broken on Linux systems. The cause seems to be that linux takes the added quotes inside process arguments literally, so it attempts to make cargo-watch run the command `cargo "check --message-format json"` with the entire quoted part being treated as a single long subcommand, which cargo doesn't know how to handle. Removing the extra quotes solves the issue. --- editors/code/src/commands/cargo_watch.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index d45d0e7d1..5534084bb 100644 --- a/editors/code/src/commands/cargo_watch.ts +++ b/editors/code/src/commands/cargo_watch.ts @@ -46,12 +46,11 @@ export class CargoWatchProvider { 'Cargo Watch Trace' ); - let args = '"check --message-format json'; + let args = 'check --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; } - args += '"'; // Start the cargo watch with json message this.cargoProcess = child_process.spawn( -- cgit v1.2.3 From 3a79490187264c5cf11a59d8fd1738f876829f6a Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 10:38:18 +0200 Subject: Add extra double quotes only on Windows. As tested by @edwin0cheng, Windows requires the quotes removed in the previous commit. This commit re-adds the quotes gated by an if statement on the node environment, so that quotes are only added on Windows. --- editors/code/src/commands/cargo_watch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index 5534084bb..6b6113017 100644 --- a/editors/code/src/commands/cargo_watch.ts +++ b/editors/code/src/commands/cargo_watch.ts @@ -51,6 +51,10 @@ export class CargoWatchProvider { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; } + // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes + if (process.platform == "win32") { + args = '"' + args + '"'; + } // Start the cargo watch with json message this.cargoProcess = child_process.spawn( -- cgit v1.2.3 From b8ea91ae2d94f11f003df6ab36c3761dd2932362 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 11:01:34 +0200 Subject: Fix eslint errors --- editors/code/src/commands/cargo_watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index 6b6113017..32bd38a1c 100644 --- a/editors/code/src/commands/cargo_watch.ts +++ b/editors/code/src/commands/cargo_watch.ts @@ -52,7 +52,7 @@ export class CargoWatchProvider { args += ' ' + Server.config.cargoWatchOptions.checkArguments; } // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes - if (process.platform == "win32") { + if (process.platform === 'win32') { args = '"' + args + '"'; } -- cgit v1.2.3