Commit cf96f1ff authored by Reed Essick's avatar Reed Essick

Modified how commands are read out of config file when passed to...

Modified how commands are read out of config file when passed to subprocess.Popen and/or multiprocessing.Process. This should be entirely backward compatible, but will now allow users to specify command line options and arguments directly within the INI file rather than having to use a wrapper script. The caveat here is there cannot be an spaces within a single option. For example, \'script --option option1\' is fine but \'script --option "option 1"\' is not.
parent 672bba44
......@@ -239,7 +239,7 @@ class LVAlertHandler(object):
### we use "spooled" tempfiles because they exist only in memory (if small enought)
### max_size=1000 (bytes?) should be larger than most expected lvalert messages?
elif self.wait:
p = Popen([self.actions[n]], stdin=PIPE, stdout=PIPE)
p = Popen(action.split(), stdin=PIPE, stdout=PIPE)
print(p.communicate(e)[0])
else:
# import tempfile
......@@ -249,8 +249,7 @@ class LVAlertHandler(object):
### without this, the position in file_obj gets messed up
### no idea why, but it might be related to long messages becoming multiple stanzas
file_obj.seek(0, 0)
# p = Popen([self.actions[n]], stdin=file_obj)
p = multiprocessing.Process(target=forked_wait, args=([self.actions[n]], file_obj))
p = multiprocessing.Process(target=forked_wait, args=(action.split(), file_obj))
p.start()
p.join()
file_obj.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment