Skip to content

Should exit with nonzero status if command fails #1347

@BanzaiMan

Description

@BanzaiMan

See travis-ci/travis-ci#7001 (comment) for context.

Currently, when nvm install fails, it exits with status 0. This is not optimal for use in scripts where various error recovery should be tried after this failure.

$ nvm install 4
VERSION_PATH=''
#                                                                          1.8%
curl: (56) SSLRead() return error -9806
Binary download from https://nodejs.org/dist/v4.7.0/node-v4.7.0-darwin-x64.tar.xz failed, trying source.
grep: /Users/asari/.nvm/.cache/bin/node-v4.7.0-darwin-x64/node-v4.7.0-darwin-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 4 CPU thread(s)
Set the number of jobs to 4 - 1 = 3 jobs to speed up the build
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums do not match: '069d5ee4f79eace011758601f9c048f5c22b9673759beaf31308c43842f4f838' found, 'b03c777ba8817a8478d57f00797db86dc7e7953d2066c34edbceeba8ad056142' expected.
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
nvm: install v4.7.0 failed!
$ echo $?
0

If breaking the changes is a concern, perhaps we can add a new flag to the commands so that certain failures can cause non-zero exit status. (For example, curl would do this if you add -f; otherwise it always exits with 0.)

Metadata

Metadata

Assignees

Labels

bugsOh no, something's broken :-(installing nodeIssues with installing node/io.js versions.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions