From 0c490dfee3604816dcceb628d2b7b263a744f7a9 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 11 May 2021 17:51:46 -0400 Subject: Clean up after ourselves Remember to remove the temporary mbox if we're done with it. Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/b4/mbox.py b/b4/mbox.py index 7804535..e418572 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -541,7 +541,8 @@ def main(cmdargs): try: import patatt except ModuleNotFoundError: - logger.info('--show-keys requires patatt library') + logger.info('--show-keys requires the patatt library') + os.unlink(threadfile) sys.exit(1) keydata = set() @@ -564,8 +565,11 @@ def main(cmdargs): logger.debug('Unknown key type: %s', algo) continue keydata.add((identity, algo, selector, keyinfo)) + mbx.close() + if not keydata: logger.info('No keys found in the thread.') + os.unlink(threadfile) sys.exit(0) krpath = os.path.join(b4.get_data_dir(), 'keyring') pgp = False @@ -605,6 +609,8 @@ def main(cmdargs): if ecc: logger.info('For ed25519 keys:') logger.info(' echo [pubkey] > [fullpath]') + + os.unlink(threadfile) sys.exit(0) logger.info('%s messages in the thread', len(mbx)) -- cgit v1.2.3