Updated exists to async

This commit is contained in:
Elio Struyf
2022-10-06 21:49:53 +02:00
parent fad5ad7243
commit a072957793
15 changed files with 55 additions and 55 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ import { DashboardCommand } from '../dashboardWebView/DashboardCommand';
import { ParsedFrontMatter } from '../parsers';
import { TelemetryEvent } from '../constants/TelemetryEvent';
import { SETTING_CUSTOM_SCRIPTS } from '../constants';
import { existsSync } from 'fs';
import { existsAsync } from '../utils';
export class CustomScript {
@@ -264,7 +264,7 @@ export class CustomScript {
* @returns
*/
public static async executeScript(script: ICustomScript, wsPath: string, args: string): Promise<string> {
return new Promise((resolve, reject) => {
return new Promise(async (resolve, reject) => {
// Check the command to use
let command = script.nodeBin || "node";
@@ -274,7 +274,7 @@ export class CustomScript {
const scriptPath = join(wsPath, script.script);
if (!existsSync(scriptPath)) {
if (!await existsAsync(scriptPath)) {
reject(new Error(`Script not found: ${scriptPath}`));
return;
}