Exit Code always 0
Bug Report
It would appear the cordova cli always returns an exit code of 0. I have found this related post which describes a similar issue: https://issues.apache.org/jira/browse/CB-13959
Problem
In my case I have a hook that executes before platform remove. If this throws an exception, the command stops.
What is expected to happen?
I expect a non zero exit code
What does actually happen?
I get an exit code of 0
PS C:\Cordova> lcordova platform rm android
checking file: package.json
File package.json can be read and written
checking file: package-lock.json
File package-lock.json can be read and written
checking file: config.xml
(node:54088) UnhandledPromiseRejectionWarning: Error: File is not writable: config.xml
at \hooks\areKeyFilesWritable.js:40:10
at Array.forEach (--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:54088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS C:\Cordova>echo $lastExitCode
0
Information
Command or Code
config.xml:
areKeyFilesWritable.js throw new Error("threw an error");
Environment, Platform, Device
Windows 10, Powershell
Version information
Cordova Packages:
cli: 10.0.0
common: 4.0.2
create: 3.0.0
lib: 10.0.0
common: 4.0.2
fetch: 3.0.0
serve: 4.0.0
Project Installed Platforms:
android: 9.0.0
Project Installed Plugins: N/A Environment:
OS: Microsoft Windows 10 Pro 10.0.17763 (17763) (win32 10.0.17763) x64
Node: v12.18.4
npm: 6.14.6
Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above