Fixes for recently-introduced readline and $&time
bugs
#153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #151 (introduced with #128) and #152 (introduced with #143).
getrusage()
has been pulled out ofproc.c
entirely and is now managed within$&time
. I think this structure is a lot better in terms of separation-of-concerns. It's also nicely simple to implement with howgetrusage()
works, which is something that seemed very weird to me at first. So that's nice!It occurs to me with this change that if we make use of
getrusage(RUSAGE_SELF)
as well, we could actually$&time
commands without forking, which seems like an interesting possibility. If you have a slow-running script, you could just wrap whole sections inside atime {}
without any disruption to the script's function... Even better, it looks like the standardtimes()
also supports getting times from the calling process, so we could keep things consistent. (Edit: This is now #154)We don't do anything so clever with
rl_reset_screen_size()
, even though it's easy to imagine something that waits for aSIGWINCH
and only calls resets the screen size then. However, that requires a novel kind of special signal handling forSIGWINCH
, andSIGWINCH
isn't even technically POSIX.1-2001 standard, so we'd have to wrap a fair amount inside of#ifdef SIGWINCH
, and this is all adding a fair amount of complexity for a very negligible performance/efficiency gain.