impl FromStr for sys::Signal #884
Conversation
The failure looks spurious:
|
I fixed the ENOSPC and restarted the builds. |
I don't agree with this change. If nix were an interactive shell it would make sense. But nix is a library. Why would we want to intentionally broaden our API by publishing multiple spellings of common symbols? I've worked on projects that did things like this. I just creates inconsistency and confusion, not to mention more maintenance. |
Fair enough. Would you be more receptive to a change that only accepts a subset of these spellings? For example, just the exact matches (only SIGHUP, not SIGHUP and HUP and sighup and hup)? I'm happy to adjust. This is also just a way to reduce boilerplate and a newtype in one of my projects so I wouldn't be terribly upset if you just want to reject this. |
I don't like that there isn't a @quodlibetor What's your use case here? You want to parse command-line arguments specifying signals or are these strings in a data stream? |
@Susurrus I'm happy to implement This PR verifies that the I would slightly prefer to keep both all-caps versions (e.g. |
What I would suggest is that we only support the |
I've done most of that. I implemented |
I would still prefer to include the short-all-caps names, but if you're happy with this then so am I. |
9aa5472
to
d5db6f7
I'd love to see this shipped. Is there anything I can help with? |
@Mange Take it for a spin in your own code, feel free to leave a review or feedback. |
This looks good to me at this point. @asomers any comments? Before merging, it does need the following:
|
I agree with susurrus. It looks good except for the CHANGELOG entry and the squash. |
d5db6f7
to
ec8f415
This is a subset of what `kill` accepts in many shells. The Display implementation matches the `Debug` representation of `Signal`. The `FromStr` matches both Debug/Display which means it can be round-tripped, if desired.
ec8f415
to
8de86cc
bors r+ |
884: impl FromStr for sys::Signal r=Susurrus a=quodlibetor This implements both ALLCAPS and lowercase full name (including SIG) and short name. This matches what `kill` accepts in many shells, and it also allows the `Debug` representation of `Signal`, which means it can be round-tripped, if desired. Co-authored-by: Brandon W Maister <quodlibetor@gmail.com>
…re it belongs.
973: CHANGELOG: move entry from #884 from 0.11.0 to [Unreleased] r=asomers a=mpasternacki PR #884 added changelog entry in section for 0.11.0, which has been already released, instead of in the [Unreleased] section (which wasn't present yet). Moved the entry where it belongs. Co-authored-by: Maciej Pasternacki <maciej@3ofcoins.net>
This implements both ALLCAPS and lowercase full name (including SIG) and short
name.
This matches what
kill
accepts in many shells, and it also allows theDebug
representation of
Signal
, which means it can be round-tripped, if desired.