From a85ecb546b2bf2b56d1a78813cd8586cbdceaa66 Mon Sep 17 00:00:00 2001 From: Felipe Lavratti Date: Sun, 18 Sep 2022 23:58:39 +0100 Subject: [vscode] [minor] change the promise handling style of fs.stat --- editors/vscode/src/commands.ts | 8 +++++--- 1 file 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[] = []; possibleExecutables.forEach((executable) => { promises.push(new Promise((resolve) => { - fs.stat(executable, (exists) => { - resolve(exists === null ? executable : null); + fs.stat(executable).then((stats) => { + resolve(executable); + }).catch((error) => { + resolve(null); }); })); }); -- cgit v1.2.3