Skip to content

Instantly share code, notes, and snippets.

@geoffkoh
Created January 26, 2020 04:11
Show Gist options
  • Select an option

  • Save geoffkoh/33138f0cb60852ca8cc29c1c3113cef0 to your computer and use it in GitHub Desktop.

Select an option

Save geoffkoh/33138f0cb60852ca8cc29c1c3113cef0 to your computer and use it in GitHub Desktop.
class LocalExecutor(ExecutorBase):
def run(self, command: str) -> (str, str):
""" Runs the given command using subprocess """
args = shlex.split(command)
stdout, stderr = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
out = stdout.decode('utf-8')
err = stderr.decode('utf-8')
return out, err
# end run()
# end class LocalExecutor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment