Repository navigation
handle kill -0 as signal shorthand and update PID handling - #18081
Conversation
|
Why are we treating |
I'm not really sure what you're asking. Is my description not good enough? At some point we need to take this a step further and quit shelling out to kill processes. We also need to isolate better how Windows works vs how macos/linux works. |
What I meant is, that fact that nu was treating negative pid as signal number ws wrong in the first place. There is nowhere in the help page that suggest one can specify signal using |
|
We should add nushell/crates/nu-system/src/util.rs Lines 48 to 57 in a44c6ed |
|
If you want to rewrite this PR or another to fix this issue the way you think it should be done. Feel free. I'll close this one when that PR lands. |
|
@fdncred is there any reason we are not using uu-kill from uutils-coreutils |
|
@Juhan280 I'd love to but it's not supported on Windows. https://uutils.github.io/coreutils/docs/platforms.html |
|
Ohh, I will see what other options we have. maybe will make a pr if i get something working |
|
I was looking around a bit this morning and found this. It doesn't look well supported but it does cover our platforms pretty good. https://github.com/harryplusplus/kill-tree/tree/main/crates/libs/kill_tree |
|
I'm thinking that if we can set signature with |
|
Btw, in case you are not aware, negative pid for kill has special meaning. From
|
Imo, we shouldn't treat negative pid as signals. And we don't according to the documentation. |
|
I've updated the PR to disallow things like |
| } | ||
| } | ||
|
|
||
| fn inferred_signal_number(raw: &[u8], pid: i64) -> Option<u64> { |
There was a problem hiding this comment.
Is just checking raw[0] == b'-' enough? I guess raw itself is always a number.
There was a problem hiding this comment.
I think raw[0] is too brittle. I changed it to a safe parse of the raw token (optional '-' + digits), so kill -0 style shorthand is handled correctly without direct indexing assumptions.
Description
This PR fixes #18080. After this PR if you type
kill -0it'll now give an error similar to the one below.User-facing changes (Release notes)
Updated
killsignal shorthand handlingAllow
kill -0to show an error instead of killing nushell. Disallow commands likekill -9 pidbecause syntax should bekill -s 9 pid.Additional notes