Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit Code always 0 #540

Open
wrightsonm opened this issue Nov 19, 2020 · 0 comments
Open

Exit Code always 0 #540

wrightsonm opened this issue Nov 19, 2020 · 0 comments

Comments

@wrightsonm
Copy link

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 ()
at module.exports (hooks\areKeyFilesWritable.js:23:8)
at runScriptViaModuleLoader (hooks\HooksRunner.js:157:32)
at runScript (hooks\HooksRunner.js:136:12)
at hooks\HooksRunner.js:108:40
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:54088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant