Last active
January 20, 2020 11:55
-
-
Save laixintao/21599449956d218482a6a3087164b516 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import run | |
# not working, Bad file descriptor | |
run( | |
"head /dev/random -c 100", | |
stdout=open("/tmp/head.out", "wb", 0).fileno(), | |
shell=True, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import run | |
out = open("/tmp/head.out", "wb", 0) | |
run( | |
"head /dev/random -c 100", | |
stdout=out.fileno(), | |
shell=True, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment