mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
utils: save log file on failure.
This broke somewhere in the recent changes, because we override TailalbleProc stop(). Break out log extractor. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f35e29607d
commit
243fc2c05a
1 changed files with 6 additions and 1 deletions
|
@ -58,12 +58,15 @@ class TailableProc(object):
|
|||
self.thread.start()
|
||||
self.running = True
|
||||
|
||||
def stop(self, timeout=10):
|
||||
def save_log(self):
|
||||
if self.outputDir:
|
||||
logpath = os.path.join(self.outputDir, 'log')
|
||||
with open(logpath, 'w') as f:
|
||||
for l in self.logs:
|
||||
f.write(l + '\n')
|
||||
|
||||
def stop(self, timeout=10):
|
||||
self.save_log()
|
||||
self.proc.terminate()
|
||||
|
||||
# Now give it some time to react to the signal
|
||||
|
@ -340,6 +343,8 @@ class LightningNode(object):
|
|||
if rc is None:
|
||||
rc = self.daemon.stop()
|
||||
|
||||
self.daemon.save_log()
|
||||
|
||||
if rc != 0 and not self.may_fail:
|
||||
raise ValueError("Node did not exit cleanly, rc={}".format(rc))
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue