1
1
'''
2
2
Task runner.
3
3
'''
4
+
5
+ import os
6
+ import sys
7
+
8
+ sys .path .append (os .path .dirname (__file__ ))
9
+
4
10
import argparse
5
11
import copy
6
12
import json
@@ -150,8 +156,8 @@ def _rewrite_local_git_urls(buildconfig):
150
156
Prefix all git repository urls in buildconfig that start with a slash
151
157
(they reference local files) with a prefix of the local machine/user.
152
158
'''
153
- hostname = utils .check_output (['hostname' , '-f' ]).strip ()
154
- user = utils .check_output (['whoami' ]).strip ()
159
+ hostname = utils .check_output (['hostname' , '-f' ], encoding = 'utf8' ).strip ()
160
+ user = utils .check_output (['whoami' ], encoding = 'utf8' ).strip ()
155
161
for name , config in buildconfig .items ():
156
162
if not isinstance (config , dict ):
157
163
continue
@@ -294,7 +300,7 @@ def _make_buildscript(hook, buildconfig, keep_buildconfig=False):
294
300
buildconfig_file .close ()
295
301
build = utils .check_output ([hook , _userdir , buildconfig .taskfilename ,
296
302
buildconfig_filename ,
297
- buildconfig .taskname ], cwd = _hooksdir )
303
+ buildconfig .taskname ], cwd = _hooksdir , encoding = 'utf8' )
298
304
if not keep_buildconfig :
299
305
os .unlink (buildconfig_filename )
300
306
@@ -307,7 +313,7 @@ def _make_buildscript(hook, buildconfig, keep_buildconfig=False):
307
313
308
314
def _mk_submit_results (buildname ):
309
315
return utils .check_output (['./mk-submit-results' , _userdir , buildname ],
310
- cwd = _hooksdir )
316
+ cwd = _hooksdir , encoding = 'utf8' )
311
317
312
318
313
319
def _command_try (args ):
@@ -322,7 +328,7 @@ def _command_try(args):
322
328
tempf .write (build )
323
329
tempf .close ()
324
330
utils .check_call (['./exec-try-build' , _userdir , tempf .name , buildname ],
325
- cwd = _hooksdir )
331
+ cwd = _hooksdir , encoding = 'utf8' )
326
332
os .unlink (tempf .name )
327
333
328
334
@@ -339,7 +345,7 @@ def _command_submit(args):
339
345
tempf .write (build )
340
346
tempf .close ()
341
347
utils .check_call (['./submit' , _userdir , tempf .name , buildname ],
342
- cwd = _hooksdir )
348
+ cwd = _hooksdir , encoding = 'utf8' )
343
349
os .unlink (tempf .name )
344
350
345
351
@@ -368,7 +374,7 @@ def _command_jenkinsrun(args):
368
374
repro_script = os .path .join (taskdir , 'repro_message.sh' )
369
375
if os .access (repro_script , os .X_OK ):
370
376
utils .check_call ([repro_script , _userdir ,
371
- buildconfig .taskfilename ])
377
+ buildconfig .taskfilename ], encoding = 'utf8' )
372
378
sys .exit (retcode )
373
379
374
380
@@ -387,7 +393,7 @@ def _command_sshrun(args):
387
393
run_file .close ()
388
394
try :
389
395
utils .check_call (['./sshrun' , argconfig .hostname , run_file .name ],
390
- cwd = _hooksdir )
396
+ cwd = _hooksdir , encoding = 'utf8' )
391
397
finally :
392
398
os .unlink (run_file .name )
393
399
0 commit comments