diff --git a/kitty_tests/atexit.py b/kitty_tests/atexit.py index a09433427a..2ff09124fb 100644 --- a/kitty_tests/atexit.py +++ b/kitty_tests/atexit.py @@ -44,6 +44,14 @@ def read(): p.stdin.flush() select.select(readers, [], [], 10) self.ae(read(), str(i+1)) + sdir = os.path.join(self.tdir, 'd') + os.mkdir(sdir) + p.stdin.write(f'rmtree {sdir}\n'.encode()) + p.stdin.flush() + open(os.path.join(sdir, 'f'), 'w').close() + select.select(readers, [], [], 10) + self.ae(read(), str(i+2)) + self.assertTrue(os.listdir(self.tdir)) # Ensure child is ignoring signals diff --git a/tools/cmd/atexit/main.go b/tools/cmd/atexit/main.go index 9735c5ab6a..fc7b696f94 100644 --- a/tools/cmd/atexit/main.go +++ b/tools/cmd/atexit/main.go @@ -44,6 +44,11 @@ func main() (rc int, err error) { fmt.Fprintln(os.Stderr, "Failed to remove:", rest, "with error:", err) rc = 1 } + case "rmtree": + if err := os.RemoveAll(rest); err != nil { + fmt.Fprintln(os.Stderr, "Failed to remove:", rest, "with error:", err) + rc = 1 + } } } }