Summary
Implement transaction abort functionality in the PreflightExec modal. Currently, pressing 'x' only shows a toast message but doesn't actually abort the running PTY process that executes package operations (install/remove/downgrade/update).
Files to modify
src/events/modals/common.rs (around line 256)
src/app/runtime/workers/executor.rs (communication and abort signaling)
src/app/runtime/channels.rs (add abort channel)
Expected behavior
When users press 'x' in the PreflightExec modal during execution:
- Signal the executor worker to abort the current operation
- Kill the running PTY child process gracefully
- Clean up any temporary resources and file handles
- Show appropriate feedback about the aborted operation
- Return to a safe state allowing retry or cancellation
Implementation approach
-
Add abort signaling infrastructure:
- Add an abort channel to the Channels struct
- Pass abort receiver to executor worker
- Send abort signal from UI when 'x' is pressed
-
Modify PTY execution:
- Check for abort signal in the execution loop
- Kill child process when abort is requested
- Handle cleanup and proper exit
-
Update UI state:
- Transition modal to appropriate state after abort
- Show clear user feedback about aborted operation
- Handle edge cases (process already finished, abort failed, etc.)
Testing
Additional context
The current PTY execution uses portable_pty and runs bash commands in a spawned child process. The executor worker runs in a separate tokio task, so implementing abort requires inter-task communication. Follow the existing channel patterns used for other executor communications.
Key considerations:
- Handle race conditions between process completion and abort requests
- Ensure proper cleanup of PTY resources and file descriptors
- Provide clear user feedback for different abort scenarios
- Maintain compatibility with existing dry-run functionality
- Consider platform differences (Unix vs Windows execution)
Summary
Implement transaction abort functionality in the PreflightExec modal. Currently, pressing 'x' only shows a toast message but doesn't actually abort the running PTY process that executes package operations (install/remove/downgrade/update).
Files to modify
src/events/modals/common.rs(around line 256)src/app/runtime/workers/executor.rs(communication and abort signaling)src/app/runtime/channels.rs(add abort channel)Expected behavior
When users press 'x' in the PreflightExec modal during execution:
Implementation approach
Add abort signaling infrastructure:
Modify PTY execution:
Update UI state:
Testing
cargo checkpassescargo clippy --all-targets --all-features -- -D warningspassescargo test -- --test-threads=1passesAdditional context
The current PTY execution uses
portable_ptyand runs bash commands in a spawned child process. The executor worker runs in a separate tokio task, so implementing abort requires inter-task communication. Follow the existing channel patterns used for other executor communications.Key considerations: