4 class PidFileManager(object):
5 def __init__(self
, label
, results_dir
):
6 self
.path
= os
.path
.join(results_dir
, ".%s_execute" % label
)
8 self
.num_tests_failed
= 0
12 self
.pid_file
= open(self
.path
, "w")
13 self
.pid_file
.write("%s\n" % os
.getpid())
17 def close_file(self
, exit_code
, signal_code
=0):
20 pid_file
= self
.pid_file
22 encoded_exit_code
= ((exit_code
& 0xFF) << 8) |
(signal_code
& 0xFF)
23 pid_file
.write("%s\n" % encoded_exit_code
)
24 pid_file
.write("%s\n" % self
.num_tests_failed
)