Skip to content

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

Closed

Description

@wracoon

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.

Activity

  1. amoffat commented on Dec 25, 2014

    @amoffat
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions