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.
This commit is contained in:
Lewis Sanchez
2021-11-15 10:03:42 -08:00
committed by GitHub
parent bf1cc057be
commit 77e9d1c3a0

View File

@@ -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)));