diff options
| author | Felipe Lavratti <felipelav@gmail.com> | 2022-09-18 23:58:39 +0100 |
|---|---|---|
| committer | Felipe Lavratti <felipelav@gmail.com> | 2022-09-19 16:39:35 +0100 |
| commit | a85ecb546b2bf2b56d1a78813cd8586cbdceaa66 (patch) | |
| tree | ad8161194302cb00e576afd7fd515c2575923265 | |
| parent | a20ef3bbb526b29255bd0a072934b2108286c3a6 (diff) | |
[vscode] [minor] change the promise handling style of fs.stat
| -rw-r--r-- | editors/vscode/src/commands.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/vscode/src/commands.ts b/editors/vscode/src/commands.ts index 69850ce..f1f617f 100644 --- a/editors/vscode/src/commands.ts +++ b/editors/vscode/src/commands.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import { Ctx, Cmd } from './ctx'; import { execFile } from 'child_process'; import path = require('path'); -import fs = require('fs'); +import { promises as fs } from "fs"; import { getDebugConfiguration } from './debug'; export function runDebugTest(ctx: Ctx): Cmd { @@ -55,8 +55,10 @@ export function runDebugTest(ctx: Ctx): Cmd { let promises : Promise<string | null>[] = []; possibleExecutables.forEach((executable) => { promises.push(new Promise<string | null>((resolve) => { - fs.stat(executable, (exists) => { - resolve(exists === null ? executable : null); + fs.stat(executable).then((stats) => { + resolve(executable); + }).catch((error) => { + resolve(null); }); })); }); |