danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.82k stars 100 forks source link

Failure should result in non-zero exit code #174

Closed kumavis closed 4 years ago

kumavis commented 4 years ago

Description command results in error, but completes as if successful

Steps to reproduce

touch empty.js && npx source-map-explorer empty.js && echo 'bug: process ended with non-zero exit code'
empty.js
  Unable to find a source map.
  See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps
bug: process ended with non-zero exit code

Files to reproduce no files needed

Expected behavior When a fatal error is encountered, it should exit the process with a non-zero exit code

Environment

Additional context Other errors like failing to find the reference sourcemap file should result in a non-zero exit code

npx source-map-explorer dist/chrome/common.js && echo 'bug: process ended with non-zero exit code'
dist/chrome/common.js
  An error occurred while trying to read the map file at /home/xyz/Development/metamask-extension2/dist/sourcemaps/common.js.map
  Error: ENOENT: no such file or directory, open '/home/xyz/Development/metamask-extension2/dist/sourcemaps/common.js.map'
bug: process ended with non-zero exit code
nikolay-borzov commented 4 years ago

@kumavis, what about the case when there are two bundles and only one failed?

kumavis commented 4 years ago

if there was a failure i would expect a non-zero exit code