Process – process handle

class uv.Process(arguments, uid=None, gid=None, cwd=None, env=None, stdin=None, stdout=None, stderr=None, stdio=None, flags=<ProcessFlags.WINDOWS_HIDE: 16>, loop=None, on_exit=None)[source]

Process handles will spawn a new process and allow the user to control it and establish communication channels with it using streams.

Raises:

uv.UVError – error while initializing the handle

Parameters:
  • arguments (list[unicode]) – program path and command line arguments
  • uid (int) – spawn as user with user id uid
  • gid (int) – spawn as group with group id gid
  • cwd (unicode) – child process working directory
  • env (dict[unicode,unicode]) – child process environment variables
  • flags (int) – process spawn flags to be used
  • stdin (int | uv.UVStream | uv.CreatePipe | file-like | None) – standard input of the child process
  • stdout (int | uv.UVStream | uv.CreatePipe | file-like | None) – standard output of the child process
  • stderr (int | uv.UVStream | uv.CreatePipe | file-like | None) – standard error of the child process
  • stdio (list[int | uv.UVStream | uv.CreatePipe | file-like]) – other standard file descriptors of the child process
  • loop (uv.Loop) – event loop the handle should run on
  • on_exit (Callable[[uv.Process, int, int], None]) – callback which should be called after process exited
stdin = None

Standard input of the child process.

Readonly:True
Type:int | uv.UVStream | file-like | None
stdout = None

Standard output of the child process.

Readonly:True
Type:int | uv.UVStream | file-like | None
stderr = None

Standard error of the child process.

Readonly:True
Type:int | uv.UVStream | file-like | None
stdio = None

Other standard file descriptors of the child process.

Readonly:True
Type:list[int | uv.UVStream | file-like]
on_exit = None

Callback which should be called after process exited.

on_exit(process_handle, returncode, signum)
Parameters:
  • process_handle (uv.Process) – handle the call originates from
  • returncode (int) – status code returned by the process on termination
  • signum (int) – signal number caused the process to exit
Readonly:False
Type:Callable[[uv.Process, int, int], None]
pid

PID of the spawned process.

Raises:uv.ClosedHandleError – handle has already been closed or is closing
Readonly:True
Return type:int
kill(signum=<Signals.SIGINT: 2>)[source]

Send the specified signal to the process.

Raises:uv.ClosedHandleError – handle has already been closed or is closing
Parameters:signum (int) – signal number
class uv.CreatePipe(readable=False, writable=False, ipc=False)[source]

Passed to one of the standard IO arguments of Process, it tells the library to create a new pipe to communicate with the child process.

Parameters:
  • readable (bool) – pipe should be readable
  • writable (bool) – pipe should be writable
  • ipc (bool) – pipe should support inter process communication
uv.PIPE = <CreatePipe readable=True, writable=True, ipc=True>

Create a readable and writable inter process communication pipe.

class uv.ProcessFlags[source]

Process configuration flags enumeration.

DETACHED = None

Spawn the child process in a detached state – this will make it a process group leader, and will effectively enable the child to keep running after the parent exits. Note that the child process will still keep the parent’s event loop alive unless the parent process calls uv.Handle.dereference() on the child’s process handle.

Type:uv.ProcessFlags
WINDOWS_HIDE = None

Hide the subprocess console window that would normally be created. This option is only meaningful on Windows systems. By default it is enabled, to disable this flag pass 0 to uv.Process‘s flag parameter. On Unix it is ignored.

Type:uv.ProcessFlags
WINDOWS_VERBATIM = None

Do not wrap any arguments in quotes, or perform any other escaping, when converting the argument list into a command line string. This option is only meaningful on Windows systems. On Unix it is ignored.

Type:uv.ProcessFlags