This repository was archived by the owner on Nov 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,14 @@ async function hasToolchain(config: RustupConfig): Promise<boolean> {
90
90
return stdout . includes ( config . channel ) ;
91
91
} catch ( e ) {
92
92
console . log ( e ) ;
93
- // rustup not present
93
+ const rustupFoundButNotInWSLMode =
94
+ config . useWSL && ( await hasRustup ( { useWSL : false , ...config } ) ) ;
95
+
94
96
window . showErrorMessage (
95
- 'Rustup not available. Install from https://www.rustup.rs/' ,
97
+ rustupFoundButNotInWSLMode
98
+ ? `Rustup is installed but can't be found under WSL. Ensure that
99
+ invoking \`wsl rustup\` works correctly.`
100
+ : 'Rustup not available. Install from https://www.rustup.rs/' ,
96
101
) ;
97
102
throw e ;
98
103
}
@@ -232,6 +237,15 @@ export async function getVersion(config: RustupConfig): Promise<string> {
232
237
}
233
238
}
234
239
240
+ /**
241
+ * Returns whether Rustup is invokable and available.
242
+ */
243
+ export function hasRustup ( config : RustupConfig ) : Promise < boolean > {
244
+ return getVersion ( config )
245
+ . then ( ( ) => true )
246
+ . catch ( ( ) => false ) ;
247
+ }
248
+
235
249
/**
236
250
* Returns active (including local overrides) toolchain, as specified by rustup.
237
251
* May throw if rustup at specified path can't be executed.
You can’t perform that action at this time.
0 commit comments