From 77e9d1c3a0c9dd918674fa3f62fe2514d6b2ca16 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com> Date: Mon, 15 Nov 2021 10:03:42 -0800 Subject: [PATCH] Corrects Web Build Pipeline ENOENT Error (#17656) * Checks for successful directory creation * Revert "Checks for successful directory creation" This reverts commit 372409ef323f0d82e11992bc7bc33d607a7d5581. * Checks for the existence of the logs directory before accessing. * Adds SQL carbon edit comment * Removing call to copy from non-existing directory. * Removes unneeded import * Checks for file existence before copying. * Provides explanation for modification * Replaces file existence check with exception handling. --- test/smoke/src/main.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index ae7620b743..b065a89ecb 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -279,7 +279,19 @@ after(async function () { if (opts.log) { const logsDir = path.join(userDataDir, 'logs'); const destLogsDir = path.join(path.dirname(opts.log), 'logs'); - await new Promise((c, e) => ncp(logsDir, destLogsDir, err => err ? e(err) : c(undefined))); + + // {{ SQL CARBON EDIT }} + /** + * The logs directory is not present during the ADS web build, but is during the Darwin build. + * In situations where the directory is missing and a copy attempt is made, bash exits with code 255 and raises an error + * explaining that there's no such file or directory. This prevents that error from occurring. + */ + try { + await new Promise((c, e) => ncp(logsDir, destLogsDir, err => err ? e(err) : c(undefined))); + } + catch (ex) { + console.warn(`Caught exception from ncp: ${ex}`); + } } await new Promise((c, e) => rimraf(testDataPath, { maxBusyTries: 10 }, err => err ? e(err) : c(undefined)));