Spawn processes using Python
If you want to run some program using Python, for example maven build use this
import subprocess
mavenProcess = subprocess.Popen('mvn clean install', stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
# use forwarder streams
print mavenProcess.stdout.read(-1)
print mavenProcess.stdin.read(-1)
print mavenProcess.stderr.read(-1)
Written by Kamil Michalak
Related protips
2 Responses
I think you mean s/p1/mavenProcess/
over 1 year ago
·
Yep, you're right :) Fixed.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Related Tags
#python
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#