Updated so fork does not have output when it writes to its pid file and updated util to make this possible.
This commit is contained in:
@@ -145,7 +145,7 @@ class ForkRunner(runner.Runner):
|
|||||||
else:
|
else:
|
||||||
#write out the child pid
|
#write out the child pid
|
||||||
contents = str(pid) + os.linesep
|
contents = str(pid) + os.linesep
|
||||||
sh.write_file(pid_fn, contents)
|
sh.write_file(pid_fn, contents, quiet=True)
|
||||||
#not exit or sys.exit, this is recommended
|
#not exit or sys.exit, this is recommended
|
||||||
#since it will do the right cleanups that we want
|
#since it will do the right cleanups that we want
|
||||||
#not calling any atexit functions, which would
|
#not calling any atexit functions, which would
|
||||||
|
|||||||
@@ -187,7 +187,8 @@ def mkdirslist(path):
|
|||||||
return dirs_made
|
return dirs_made
|
||||||
|
|
||||||
|
|
||||||
def append_file(fn, text, flush=True):
|
def append_file(fn, text, flush=True, quiet=False):
|
||||||
|
if(not quiet):
|
||||||
LOG.debug("Appending to file %s (%d bytes)", fn, len(text))
|
LOG.debug("Appending to file %s (%d bytes)", fn, len(text))
|
||||||
with open(fn, "a") as f:
|
with open(fn, "a") as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
@@ -195,7 +196,8 @@ def append_file(fn, text, flush=True):
|
|||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
|
|
||||||
def write_file(fn, text, flush=True):
|
def write_file(fn, text, flush=True, quiet=False):
|
||||||
|
if(not quiet):
|
||||||
LOG.debug("Writing to file %s (%d bytes)", fn, len(text))
|
LOG.debug("Writing to file %s (%d bytes)", fn, len(text))
|
||||||
with open(fn, "w") as f:
|
with open(fn, "w") as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
@@ -203,8 +205,9 @@ def write_file(fn, text, flush=True):
|
|||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
|
|
||||||
def touch_file(fn, die_if_there=True):
|
def touch_file(fn, die_if_there=True, quiet=False):
|
||||||
if(not isfile(fn)):
|
if(not isfile(fn)):
|
||||||
|
if(not quiet):
|
||||||
LOG.debug("Touching and truncating file %s", fn)
|
LOG.debug("Touching and truncating file %s", fn)
|
||||||
with open(fn, "w") as f:
|
with open(fn, "w") as f:
|
||||||
f.truncate(0)
|
f.truncate(0)
|
||||||
@@ -214,11 +217,13 @@ def touch_file(fn, die_if_there=True):
|
|||||||
raise excp.FileException(msg)
|
raise excp.FileException(msg)
|
||||||
|
|
||||||
|
|
||||||
def load_file(fn):
|
def load_file(fn, quiet=False):
|
||||||
|
if(not quiet):
|
||||||
LOG.debug("Loading data from file %s", fn)
|
LOG.debug("Loading data from file %s", fn)
|
||||||
data = ""
|
data = ""
|
||||||
with open(fn, "r") as f:
|
with open(fn, "r") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
if(not quiet):
|
||||||
LOG.debug("Loaded (%d) bytes from file %s", len(data), fn)
|
LOG.debug("Loaded (%d) bytes from file %s", len(data), fn)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user