Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a meaningful error when CWD does not exist
Prior to this commit, if a command was executed in a non-existing current working directory, the "exec" method of the built-in `child_process` module would throw an error that only partially described the problem, e.g. Error: spawn /bin/sh ENOENT at ChildProcess._handle.onexit (node:internal/child_process:284:19) at onErrorNT (node:internal/child_process:477:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn /bin/sh', path: '/bin/sh', spawnargs: [ '-c', '/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f -R -trusted -u MacOSATDriverServer.app' ], cmd: '/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f -R -trusted -u MacOSATDriverServer.app', stdout: '', stderr: '' } Detect this specific error condition and provide a more detailed desription, e.g. Error: Cannot access directory: /Users/example/packages/macos-at-driver-server/MacOSATDriverServer/Build/Debug at exec (/Users/example/packages/macos-at-driver-server/shared/install/macos.js:42:13) at async unregisterExtensions (/Users/example/packages/macos-at-driver-server/shared/install/macos.js:195:3) at async exports.uninstall (/Users/example/packages/macos-at-driver-server/shared/install/macos.js:123:3) at async Object.handler (/Users/example/packages/macos-at-driver-server/shared/commands/uninstall.js:13:5) { [cause]: Error: spawn /bin/sh ENOENT at ChildProcess._handle.onexit (node:internal/child_process:284:19) at onErrorNT (node:internal/child_process:477:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn /bin/sh', path: '/bin/sh', spawnargs: [ '-c', '/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f -R -trusted -u MacOSATDriverServer.app' ], cmd: '/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f -R -trusted -u MacOSATDriverServer.app', stdout: '', stderr: '' } }
- Loading branch information