Skip to content

bpo-14879: [doc] clarify how to check for errors from subprocess.Popen(..., shell=True)#26755

Merged
iritkatriel merged 5 commits intopython:mainfrom
jdevries3133:bpo-14879-subprocess-docs
Jul 22, 2021
Merged

bpo-14879: [doc] clarify how to check for errors from subprocess.Popen(..., shell=True)#26755
iritkatriel merged 5 commits intopython:mainfrom
jdevries3133:bpo-14879-subprocess-docs

Conversation

@jdevries3133
Copy link
Copy Markdown
Contributor

@jdevries3133 jdevries3133 commented Jun 16, 2021

  • When shell=True, subprocess will exec /bin/bash [args], for example.
  • If the program is not found, the shell will exit with a failure
    code (rather than raise an exception), and the problem may go unnoticed at first.

I added the exact sentence @ncoghlan put at the end of the bpo thread.

https://bugs.python.org/issue14879

* When shell=True, subprocess will exec /bin/bash [args], for example.
* If the program is not found, the shell will not exit with a failure
  code, and the problem may go unnoticed at first.
The most common exception raised is :exc:`OSError`. This occurs, for example,
when trying to execute a non-existent file. Applications should prepare for
:exc:`OSError` exceptions.
:exc:`OSError` exceptions. Note that, when ``"shell=True"``, :exc:`OSError` will
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please wrap the "will" so that the line does not exceed 80 chars.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have done that. In a separate additional commit I also went over the whole file line wrapping any other paragraphs that went over.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the separate commit - it spams the diff and makes it hard to see what you changed.

In general we don't do sweeping fixes like that, but try not to add more formatting problems with the changes we commit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it's been reverted.

@iritkatriel iritkatriel changed the title bpo-14879: [doc] subprocess shell=True OSError may not be raised bpo-14879: [doc] clarify error handling with subprocess.Popen(..., shell=True) Jun 21, 2021
@iritkatriel iritkatriel changed the title bpo-14879: [doc] clarify error handling with subprocess.Popen(..., shell=True) bpo-14879: [doc] clarify how to check for errors from subprocess.Popen(..., shell=True) Jun 21, 2021
@iritkatriel iritkatriel requested a review from giampaolo June 21, 2021 16:01
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jul 22, 2021
@jdevries3133
Copy link
Copy Markdown
Contributor Author

@iritkatriel is there anyone else who can take a second look at this if @giampaolo is unavailable?

@iritkatriel iritkatriel merged commit 50ffbe3 into python:main Jul 22, 2021
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @jdevries3133 for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link
Copy Markdown

GH-27288 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 22, 2021
…n(..., shell=True) (pythonGH-26755)

(cherry picked from commit 50ffbe3)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
@bedevere-bot
Copy link
Copy Markdown

GH-27289 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 22, 2021
…n(..., shell=True) (pythonGH-26755)

(cherry picked from commit 50ffbe3)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
iritkatriel pushed a commit that referenced this pull request Jul 22, 2021
…n(..., shell=True) (GH-26755) (GH-27289)

(cherry picked from commit 50ffbe3)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
iritkatriel pushed a commit that referenced this pull request Jul 22, 2021
…n(..., shell=True) (GH-26755) (GH-27288)

(cherry picked from commit 50ffbe3)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants