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 non-zero when ipython is given a file path to run that doesn't exist #12074

Merged
merged 1 commit into from
Jan 9, 2020
Merged

Conversation

jpotter
Copy link
Contributor

@jpotter jpotter commented Jan 4, 2020

Simple PR to update the exit code for ipython when given a file that doesn't exist from 0 ("success") to 2 (matches python's behavior for this condition).

Currently, running ipython with a file argument that does not exist causes a zero exit code. This can cause problems in automation, i.e. bash scripts that have -e set and have an invalid file path.

$ ./venv/bin/ipython no-such-file.py
[TerminalIPythonApp] WARNING | File not found: 'foo.py'
$ echo $?
0

This PR changes the behavior to:

$ ./venv/bin/ipython no-such-file.py
[TerminalIPythonApp] WARNING | File 'no-such-file.py' doesn't exist
$ echo $?
2

@Carreau
Copy link
Member

Carreau commented Jan 9, 2020

Thanks, that seem reasonable,

@Carreau Carreau merged commit c72cb7c into ipython:master Jan 9, 2020
@Carreau Carreau added this to the 7.12 milestone Feb 1, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants