2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-15 13:38:41 +00:00
nushell/crates/nu-protocol/src
Andy Gayton 1cd0544a3f
fix: relay Signals reset to plugins ()
This PR will close 

# Description

This PR expands on [the relay of signals to running plugin
processes](https://github.com/nushell/nushell/pull/13181). The Ctrlc
relay has been generalized to SignalAction::Interrupt and when
reset_signal is called on the main EngineState, a SignalAction::Reset is
now relayed to running plugins.

# User-Facing Changes

The signal handler closure now takes a `signals::SignalAction`, while
previously it took no arguments. The handler will now be called on both
interrupt and reset. The method to register a handler on the plugin side
is now called `register_signal_handler` instead of
`register_ctrlc_handler`
[example](https://github.com/nushell/nushell/pull/13510/files#diff-3e04dff88fd0780a49778a3d1eede092ec729a1264b4ef07ca0d2baa859dad05L38).
This will only affect plugin authors who have started making use of
https://github.com/nushell/nushell/pull/13181, which isn't currently
part of an official release.

The change will also require all of user's plugins to be recompiled in
order that they don't error when a signal is received on the
PluginInterface.

# Testing

```
: example ctrlc
interrupt status: false
waiting for interrupt signal...
^Cinterrupt status: true
peace.
Error:   × Operation interrupted
   ╭─[display_output hook:1:1]
 1 │ if (term size).columns >= 100 { table -e } else { table }
   · ─┬
   ·  ╰── This operation was interrupted
   ╰────

: example ctrlc
interrupt status: false   <-- NOTE status is false
waiting for interrupt signal...
^Cinterrupt status: true
peace.
Error:   × Operation interrupted
   ╭─[display_output hook:1:1]
 1 │ if (term size).columns >= 100 { table -e } else { table }
   · ─┬
   ·  ╰── This operation was interrupted
   ╰────
   ```
2024-08-06 03:35:40 -07:00
..
ast Fix $in in range expressions () 2024-07-25 18:28:44 +08:00
config Add completions.sort option () 2024-08-05 20:30:10 -04:00
debugger Overhaul $in expressions () 2024-07-17 16:02:42 -05:00
engine fix: relay Signals reset to plugins () 2024-08-06 03:35:40 -07:00
errors Fix bad method links in docstrings () 2024-07-27 19:39:29 -07:00
ir Make plugins able to find and call other commands () 2024-07-19 13:54:21 +08:00
pipeline fix: relay Signals reset to plugins () 2024-08-06 03:35:40 -07:00
plugin fix: relay Signals reset to plugins () 2024-08-06 03:35:40 -07:00
process Document public types in nu-protocol () 2024-07-11 13:30:12 +02:00
value Lift SharedCow::to_mut out of if let branches () 2024-08-03 00:26:48 +02:00
alias.rs Document public types in nu-protocol () 2024-07-11 13:30:12 +02:00
did_you_mean.rs Improve case insensitivity consistency () 2023-11-08 23:58:54 +01:00
eval_base.rs Overhaul $in expressions () 2024-07-17 16:02:42 -05:00
eval_const.rs Path migration part 3: $nu paths () 2024-08-01 10:16:31 +02:00
example.rs Overhaul the plugin cache file with a new msgpack+brotli format () 2024-04-21 07:36:26 -05:00
id.rs Internal representation (IR) compiler and evaluator () 2024-07-10 17:33:59 -07:00
lev_distance.rs Rework for new clippy lints () 2024-05-02 19:29:03 +02:00
lib.rs Add top-level crate documentation/READMEs () 2024-07-14 10:10:41 +02:00
module.rs Enable reloading changes to a submodule () 2024-06-25 18:33:37 -07:00
parser_path.rs Enable reloading changes to a submodule () 2024-06-25 18:33:37 -07:00
signature.rs Clippy fixes from stable and nightly () 2024-07-31 20:37:40 +02:00
span.rs Document public types in nu-protocol () 2024-07-11 13:30:12 +02:00
syntax_shape.rs Make parsing for unknown args in known externals like normal external calls () 2024-07-21 01:32:36 -07:00
ty.rs Deprecate group in favor of chunks () 2024-07-16 03:49:00 +00:00