1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
11 print "Usage: %s OUTPUTFILE SCRIPTNAME ARGUMENTS" % sys
.argv
[0]
12 print "Re-execs the python interpreter against SCRIPTNAME with ARGS,"
13 print "redirecting output to OUTPUTFILE."
16 abs_outputfile
= os
.path
.abspath(sys
.argv
[1])
17 abs_outputdir
= os
.path
.dirname(abs_outputfile
)
19 if not os
.path
.isdir(abs_outputdir
):
20 os
.makedirs(abs_outputdir
)
24 with
open(abs_outputfile
, "w") as f
:
25 ret
= subprocess
.Popen([sys
.executable
] + sys
.argv
[2:], stdout
=f
).wait()
28 os
.remove(abs_outputfile
)