Last Updated: February 25, 2016
·
1.912K
· kamilmichalak

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)

2 Responses
Add your response

I think you mean s/p1/mavenProcess/

over 1 year ago ·

Yep, you're right :) Fixed.

over 1 year ago ·