The sh function*args, stream=True, **kwargs)[source]

A wrapper around subprocess.Popen that returns a generator streaming output from the command specified by args

  • args – the command to run, split on whitespaces

  • stream (bool) – whether to stream the output as a generator (defaults to True)

  • kwargs – other options to pass into Popen, such as a cwd


a generator to stream lines from the subprocess output if stream is True, else the subprocess output as a completed string