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 +2
-6
lines changed
rust-analyzer/editors/code/src Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 1
1
import * as lc from "vscode-languageclient" ;
2
- import * as fs from "fs" ;
3
2
import * as vscode from "vscode" ;
4
3
import { strict as nativeAssert } from "assert" ;
5
4
import { spawnSync } from "child_process" ;
@@ -114,15 +113,12 @@ export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor {
114
113
export function isValidExecutable ( path : string ) : boolean {
115
114
log . debug ( "Checking availability of a binary at" , path ) ;
116
115
117
- if ( ! fs . existsSync ( path ) ) return false ;
118
-
119
116
const res = spawnSync ( path , [ "--version" ] , { encoding : 'utf8' } ) ;
120
117
121
- const isSuccess = res . status === 0 ;
122
- const printOutput = isSuccess ? log . debug : log . warn ;
118
+ const printOutput = res . error && ( res . error as any ) . code !== 'ENOENT' ? log . warn : log . debug ;
123
119
printOutput ( path , "--version:" , res ) ;
124
120
125
- return isSuccess ;
121
+ return res . status === 0 ;
126
122
}
127
123
128
124
/** Sets ['when'](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) clause contexts */
You can’t perform that action at this time.
0 commit comments