ninjecto.utils.command

Utilities for calling commands.

Why this module exists?

A/ Because subprocess.run didn’t exists until Python 3.5, and it became useful

until 3.6 where we could specify the encodings.

https://docs.python.org/3/library/subprocess.html#subprocess.run

This module pre-dates these versions, and offer a similar interface.

Functions

  • run(): Run the command described by args. Safely wait for command to complete,
ninjecto.utils.command.run(command)

Run the command described by args. Safely wait for command to complete, then return a CompletedProcess instance.

Parameters
command (list or str) – Command to run.
Returns
namedtuple with the following attributes:
  • args: Arguments describing the command to execute.
  • stdout: Standard output of the command as UTF-8.
  • stderr: Standard error of the command as UTF-8.
  • returncode: Return code of the command.
Return type
CompletedProcess