
Untitled
By: a guest on
May 15th, 2012 | syntax:
None | size: 1.43 KB | hits: 12 | expires: Never
msbuild fails and returns 1 when when I assign stdout and stdout to os.devnull, returns 0 otherwise
from subprocess import call
import os
import tempfile
import sys
def main():
temp_repo_name = 'temprepo'
d = tempfile.mkdtemp()
os.chdir(os.path.normpath(d))
command1 = ['hg', 'clone', r'C:temp1jxg_hcr', temp_repo_name]
devnull = open(os.devnull,'w')
rc1 = call(command1,stdout=devnull, stderr=devnull)
if rc1 != 0:
print('could not clone repo into temporary directory. Terminating Program')
sys.exit(1)
devnull.close()
devnull = open(os.devnull,'w')
os.chdir(temp_repo_name)
command2 = [r'msbuild', r'hcr_dll.sln', r'/t:Rebuild',r'/p:Configuration=Release']
rc2 = call(command2,stdout=devnull, stderr=devnull)
print rc2
if rc2 != 0:
print('could not build repo. Terminating Program')
sys.exit(1)
devnull.close()
if __name__ == '__main__':
main()
C:programmingeclipse_workspacehcr_cli_build>python hcr_cli_build.py
0
1
could not build repo. Terminating Program
rc2 = call(command2)
0
<bunch of build output>
0
#!/bin/bash
for i in 1 2 3 4
do
echo "doing $i"
msbuild.exe /c/temp/$i/jxg_hcr/hcr_dll.sln //t:Rebuild //p:Configuration=Release
echo $?
done
#!/bin/bash
for i in 1 2 3 4
do
echo "doing $i"
msbuild.exe /c/temp/$i/jxg_hcr/hcr_dll.sln //t:Rebuild //p:Configuration=Release > /dev/null
echo $?
done