snakeoil.process package

Submodules

Module contents

Process related utilities.

exception snakeoil.process.CommandNotFound(command)[source]

Bases: Exception

exception snakeoil.process.ProcessNotFound(pid)[source]

Bases: Exception

snakeoil.process.exit_as_status(status: int)[source]

Exit the same way as status.

If the status field says it was killed by a signal, then we’ll do that to ourselves. Otherwise we’ll exit with the exit code.

See http://www.cons.org/cracauer/sigint.html for more details.

Parameters:

status – A status as returned by os.wait() type funcs.

snakeoil.process.find_binary(binary: str, paths=None, fallback=None) str[source]

look through the PATH environment, finding the binary to execute

snakeoil.process.get_exit_status(status: int)[source]

Get the exit status of a child from an os.waitpid() call.

Parameters:

status – The return value of os.waitpid(pid, 0)[1]

Returns:

The exit status of the process. If the process exited with a signal, the return value will be 128 plus the signal number.