Skip to content

Exit non-zero when ipython is given a file path to run that doesn't exist#12074

Merged
Carreau merged 1 commit intoipython:masterfrom
jpotter:master
Jan 9, 2020
Merged

Exit non-zero when ipython is given a file path to run that doesn't exist#12074
Carreau merged 1 commit intoipython:masterfrom
jpotter:master

Conversation

@jpotter
Copy link
Copy Markdown

@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
Copy Markdown
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.

3 participants