Skip to content

Instantly share code, notes, and snippets.

@code4lala
Created May 16, 2022 14:09
Show Gist options
  • Save code4lala/015d8bd85dcfc43a68df95a7fd6d2d25 to your computer and use it in GitHub Desktop.
Save code4lala/015d8bd85dcfc43a68df95a7fd6d2d25 to your computer and use it in GitHub Desktop.
# python use system(3) as if c use int system(const char *command); in stdlib.h
def system(cmd, shell=True):
print('>', cmd)
pipe = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE)
pipe.wait()
text = pipe.communicate()[0]
print(text)
print('>', cmd, 'end')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment