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

Exception in child process can lead to duplicate process. #202

Closed
wracoon opened this issue Oct 3, 2014 · 1 comment
Closed

Exception in child process can lead to duplicate process. #202

wracoon opened this issue Oct 3, 2014 · 1 comment

Comments

@wracoon
Copy link

wracoon commented Oct 3, 2014

Hi,

When the child process raises exception in the child block (before executing os.execv), due to too general exception handling it can lead to duplication of process which uses sh.
I encountered the following problem because os.chdir() has raised an exception,
due to path passed to _cwd of command did not exist at the time.
Due to general exception handling in my code the rest of my python program is executed twice by
duplicate process.
Example:
try:
sh.git("clone", origin, local_dir, _cwd="nonexistent_path")
except:
Executed twice.

Fix proposal: The whole child process block should be wrapped in
try:
#child
except:
sys.exit(1)

or something similar.

@amoffat
Copy link
Owner

amoffat commented Dec 25, 2014

thanks @wracoon, fixed in release-1.10 branch

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

No branches or pull requests

2 participants