Commit daeb576
authored
Catch keyboard interrupt in
Fixes two issues:
* Exit codes of the `main()` function weren't returned to the OS by the executable.
* uncaught `KeyboardInterrupt`
* if you installed `rerun-sdk` and terminate `rerun` with ctrl+c, there was an ugly traceback
* we can catch it and return 130, which is the standard POSIX code for SIGINT termination
```
[2026-01-16T16:11:55Z INFO rerun::commands::entrypoint] Caught Ctrl-C, quitting Rerun Viewer…
[2026-01-16T16:11:55Z DEBUG eframe::native::epi_integration] Closing root viewport (ViewportCommand::CancelClose was not sent)
[2026-01-16T16:11:55Z DEBUG eframe::native::run] Asking to exit event loop…
[2026-01-16T16:11:55Z DEBUG eframe::native::run] Received Event::LoopExiting - saving app state…
[2026-01-16T16:11:55Z DEBUG eframe::native::run] eframe window closed
Traceback (most recent call last):
File "/Users/michael/code/rerun/rerun_py/rerun_sdk/rerun/__main__.py", line 25, in <module>
main()
File "/Users/michael/code/rerun/rerun_py/rerun_sdk/rerun/__main__.py", line 21, in main
return cli_main()
^^^^^^^^^^
File "/Users/michael/code/rerun/rerun_py/rerun_sdk/rerun_cli/__main__.py", line 35, in main
return subprocess.call([target_path, *sys.argv[1:]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/code/rerun/.pixi/envs/default/lib/python3.11/subprocess.py", line 391, in call
return p.wait(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/code/rerun/.pixi/envs/default/lib/python3.11/subprocess.py", line 1264, in wait
return self._wait(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/code/rerun/.pixi/envs/default/lib/python3.11/subprocess.py", line 2053, in _wait
(pid, sts) = self._try_wait(0)
^^^^^^^^^^^^^^^^^
File "/Users/michael/code/rerun/.pixi/envs/default/lib/python3.11/subprocess.py", line 2011, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
```
..now:
```
2026-01-16T16:22:03Z INFO rerun::commands::entrypoint] Caught Ctrl-C, quitting Rerun Viewer…
[2026-01-16T16:22:03Z DEBUG eframe::native::epi_integration] Closing root viewport (ViewportCommand::CancelClose was not sent)
[2026-01-16T16:22:03Z DEBUG eframe::native::run] Asking to exit event loop…
[2026-01-16T16:22:03Z DEBUG eframe::native::run] Received Event::LoopExiting - saving app state…
[2026-01-16T16:22:03Z DEBUG eframe::native::run] eframe window closed
```
```sh
echo $?
130
```
Source-Ref: b0354d8c24725faf304d42319dcf029aa5535a3frerun-sdk CLI and return exit codes (#12496)1 parent ee22b45 commit daeb576
3 files changed
Lines changed: 77 additions & 70 deletions
File tree
- crates/top/rerun/src/commands
- rerun_py/rerun_sdk
- rerun_cli
- rerun
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1242 | 1242 | | |
1243 | 1243 | | |
1244 | 1244 | | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
1286 | | - | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
1292 | | - | |
1293 | | - | |
1294 | | - | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
1295 | 1264 | | |
1296 | 1265 | | |
1297 | | - | |
1298 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1299 | 1280 | | |
1300 | | - | |
1301 | | - | |
1302 | | - | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
1303 | 1286 | | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1313 | 1291 | | |
1314 | 1292 | | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1315 | 1311 | | |
1316 | 1312 | | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
1321 | 1318 | | |
| 1319 | + | |
1322 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
1323 | 1325 | | |
1324 | 1326 | | |
1325 | 1327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
0 commit comments