From f6b5e548909498ea8e275005d96f0ecebebc3fb5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 11 Dec 2018 10:08:52 +0530 Subject: [PATCH] Fix failing test --- kitty/boss.py | 5 ++++- kitty/graphics.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 31dc70c59..c0c54ea20 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -962,4 +962,7 @@ class Boss: def safe_delete_temp_file(self, path): if is_path_in_temp_dir(path): - os.remove(path) + try: + os.remove(path) + except FileNotFoundError: + pass diff --git a/kitty/graphics.c b/kitty/graphics.c index 098e1b472..4b900de31 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -368,7 +368,10 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_ if (fd == -1) ABRT(EBADF, "Failed to open file %s for graphics transmission with error: [%d] %s", fname, errno, strerror(errno)); img->data_loaded = mmap_img_file(self, img, fd, g->data_sz, g->data_offset); close(fd); - if (tt == 't') { call_boss(safe_delete_temp_file, "s", fname); } + if (tt == 't') { + if (global_state.boss) { call_boss(safe_delete_temp_file, "s", fname); } + else unlink(fname); + } else if (tt == 's') shm_unlink(fname); break; default: