Commit fa40463
authored
Call patch invoke on control + c (#15)
<!-- mesa-description-start -->
## TL;DR
Handles `Control+C` during an `invoke` command to gracefully terminate
the remote session by updating its status to `failed`.
## Why we made these changes
Previously, interrupting an `invoke` command with `Control+C` would only
terminate the local CLI process, leaving the remote session running.
This could lead to orphaned resources and unexpected behavior. This
change ensures that when a user cancels an operation, the remote session
is properly cleaned up.
## What changed?
- **`cmd/invoke.go`**:
- Implemented a signal handler to catch `SIGINT` (`Control+C`).
- On cancellation, the CLI now sends a patch request to mark the remote
invocation as 'failed' with a user-cancelled message.
- Reordered the invocation creation process to ensure the `invocationID`
is available immediately for the cancellation handler.
<sup>_Description generated by Mesa. [Update
settings](https://app.mesa.dev/onkernel/settings/pull-requests)_</sup>
<!-- mesa-description-end -->1 parent 000a938 commit fa40463
1 file changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
104 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
| |||
0 commit comments