diff --git a/procrunner/__init__.py b/procrunner/__init__.py index eb7c290..85eb080 100644 --- a/procrunner/__init__.py +++ b/procrunner/__init__.py @@ -61,9 +61,9 @@ class _LineAggregator(object): """Buffer that can be filled with stream data and will aggregate complete - lines. Lines can be printed or passed to an arbitrary callback function. - The lines passed to the callback function are UTF-8 decoded and do not - contain a trailing newline character.""" + lines. Lines can be printed or passed to an arbitrary callback function. + The lines passed to the callback function are UTF-8 decoded and do not + contain a trailing newline character.""" def __init__(self, print_line=False, callback=None): """Create aggregator object.""" @@ -74,7 +74,7 @@ def add(self, data): """Add a single character to buffer. If one or more full lines are found, - print them (if desired) and pass to callback function.""" + print them (if desired) and pass to callback function.""" data = self._decoder.decode(data) if not data: return @@ -166,7 +166,7 @@ def get_output(self): """Retrieve the stored data in full. - This call may block if the reading thread has not yet terminated.""" + This call may block if the reading thread has not yet terminated.""" self._closing = True if not self.has_finished(): if self._debug: @@ -254,17 +254,17 @@ def _windows_resolve(command): """Try and find the full path and file extension of the executable to run. - This is so that e.g. calls to 'somescript' will point at 'somescript.cmd' - without the need to set shell=True in the subprocess. - If the executable contains periods it is a special case. Here the - win32api call will fail to resolve the extension automatically, and it - has do be done explicitly. - - :param command: The command array to be run, with the first element being - the command with or w/o path, with or w/o extension. - :return: Returns the command array with the executable resolved with the - correct extension. If the executable cannot be resolved for any - reason the original command array is returned. + This is so that e.g. calls to 'somescript' will point at 'somescript.cmd' + without the need to set shell=True in the subprocess. + If the executable contains periods it is a special case. Here the + win32api call will fail to resolve the extension automatically, and it + has do be done explicitly. + + :param command: The command array to be run, with the first element being + the command with or w/o path, with or w/o extension. + :return: Returns the command array with the executable resolved with the + correct extension. If the executable cannot be resolved for any + reason the original command array is returned. """ try: import win32api @@ -328,27 +328,27 @@ ): """Run an external process. - :param array command: Command line to be run, specified as array. - :param timeout: Terminate program execution after this many seconds. - :param boolean debug: Enable further debug messages. - :param stdin: Optional string that is passed to command stdin. - :param boolean print_stdout: Pass stdout through to sys.stdout. - :param boolean print_stderr: Pass stderr through to sys.stderr. - :param callback_stdout: Optional function which is called for each - stdout line. - :param callback_stderr: Optional function which is called for each - stderr line. - :param dict environment: The full execution environment for the command. - :param dict environment_override: Change environment variables from the - current values for command execution. - :param boolean win32resolve: If on Windows, find the appropriate executable - first. This allows running of .bat, .cmd, etc. - files without explicitly specifying their - extension. - :param string working_directory: If specified, run the executable from - within this working directory. - :return: A dictionary containing stdout, stderr (both as bytestrings), - runtime, exitcode, and more. + :param array command: Command line to be run, specified as array. + :param timeout: Terminate program execution after this many seconds. + :param boolean debug: Enable further debug messages. + :param stdin: Optional string that is passed to command stdin. + :param boolean print_stdout: Pass stdout through to sys.stdout. + :param boolean print_stderr: Pass stderr through to sys.stderr. + :param callback_stdout: Optional function which is called for each + stdout line. + :param callback_stderr: Optional function which is called for each + stderr line. + :param dict environment: The full execution environment for the command. + :param dict environment_override: Change environment variables from the + current values for command execution. + :param boolean win32resolve: If on Windows, find the appropriate executable + first. This allows running of .bat, .cmd, etc. + files without explicitly specifying their + extension. + :param string working_directory: If specified, run the executable from + within this working directory. + :return: A dictionary containing stdout, stderr (both as bytestrings), + runtime, exitcode, and more. """ time_start = time.strftime("%Y-%m-%d %H:%M:%S GMT", time.gmtime()) @@ -515,7 +515,7 @@ def run_process_dummy(command, **kwargs): """A stand-in function that returns a valid result dictionary indicating a - successful execution. The external process is not run.""" + successful execution. The external process is not run.""" warnings.warn( "procrunner.run_process_dummy() is deprecated", DeprecationWarning, stacklevel=2 )