A GPU task manager for Windows, Linux, and WSL: per-process VRAM, GPU activity, and LLM model/KV-cache insights (Windows AMD and NVIDIA).
Python
fix(record): report recording I/O failures cleanly
terminalchaidfa750075877
diff --git a/src/gputaskman/cli.py b/src/gputaskman/cli.pyindex 2fc8721..3740f2a 100644--- a/src/gputaskman/cli.py+++ b/src/gputaskman/cli.py@@ -78,6 +78,8 @@ def record_main(argv: list[str]) -> None:count = run(sample, out, interval=args.interval, duration=args.duration)except KeyboardInterrupt:pass # Ctrl+C while starting up: nothing was recorded yet+ except OSError as error:+ ap.exit(1, f"{ap.prog}: recording to {args.output} failed: {error}\n")print(f"Recorded {count} sample(s) to {args.output}", file=sys.stderr)diff --git a/tests/test_record.py b/tests/test_record.pyindex 91df7e7..2d4c2b9 100644--- a/tests/test_record.py+++ b/tests/test_record.py@@ -512,6 +512,23 @@ class CliTests(FileTestCase):self.assertIn("cannot write", err.getvalue())self.assertEqual(self.calls, [])+ def test_output_failure_after_open_reports_a_recording_error(self):+ for operation in ("flush", "__exit__"):+ with self.subTest(operation=operation):+ output = MagicMock()+ getattr(output, operation).side_effect = OSError(errno.ENOSPC, "No space left")+ err = io.StringIO()+ with self.fake_source(), patch("sys.argv", [+ "gputaskman", "record", "-o", self.path, "--duration", "0.5",+ ]), patch("gputaskman.record.append_to", return_value=output), \+ contextlib.redirect_stderr(err), self.assertRaises(SystemExit) as stop:+ main()+ self.assertEqual(stop.exception.code, 1)+ self.assertIn(f"recording to {self.path} failed", err.getvalue())+ self.assertIn("No space left", err.getvalue())+ self.assertNotIn("Recorded ", err.getvalue())+ output.__exit__.assert_called_once()+def test_help_finds_record_from_the_main_command(self):for argv, expected in ((["gputaskman", "--help"], "gputaskman record -o FILE"),(["gputaskman", "record", "--help"], "--duration")):