witty-crayon-22786
12/19/2017, 10:50 PMimport sys
from pants.util.process_handler import subprocess
if __name__ == '__main__':
with open('output.txt', 'w') as f:
sys.stdout = f
print('Doing a thing in the parent.')
subprocess.check_call(['echo', 'Echo to default destination.'])
subprocess.check_call(['echo', 'Echo to explicit destination.'], stdout=sys.stdout)