Skip to content

Commit

Permalink
fixup! Provide a meaningful error when CWD does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed Dec 11, 2024
1 parent cde46d4 commit 8047849
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions shared/install/macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ const PLUGIN_TRIPLET_IDENTIFIER = 'ausp atdg BOCU';
* Execute the "exec" method from the built-in `child_process` module. In the
* event of failure due to the absence of the specified current working
* directory, provide a meaningful error description.
*
* @param {string} command
* @param {ExecOptions} [options]
*/
const exec = async (...args) => {
const exec = async (command, options) => {
try {
return await promisify(_exec)(...args);
return await promisify(_exec)(command, options);
} catch (error) {
const cwd = args[1]?.cwd || process.cwd();
const cwd = options?.cwd || process.cwd();
const cwdExists = !!(await fs.stat(cwd).catch(() => null));

if (error.code === 'ENOENT' && !cwdExists) {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"checkJs": true,
"noEmit": true
"module": "commonjs",
"noEmit": true,
"target": "es2022"
},
"include": ["shared", "test"]
}

0 comments on commit 8047849

Please sign in to comment.