Jeffrey Finkelstein
f4af226820
uucore: error on negative interval in parse_time
...
Return an error when a negative interval is provided as the argument
to `uucore::parse_time::from_str()`, since a `Duration` should only be
non-negative.
2022-03-21 21:11:31 -04:00
Jeffrey Finkelstein
c39c917db7
sleep: give usage error on invalid time interval
...
For example,
$ sleep xyz
sleep: invalid time interval 'xyz'
Try 'sleep --help' for more information.
This matches the behavior of GNU sleep.
2022-03-20 15:21:50 -04:00
Jeffrey Finkelstein
ce2a026ff8
sleep: use Duration::saturating_add to sum times
...
Use `Duration::saturating_add()` to avoid a panic due to overflow when
adding the durations provided as command-line arguments.
2022-03-18 23:15:02 -04:00
Jeffrey Finkelstein
388cb6c83a
uucore: use Duration::saturating_mul in parse_time
...
Use `Duration::saturating_mul()` to avoid a panic due to overflow in
`uucore::parse_time::from_str()`. This change prevents panic on very
large arguments to timeout and sleep.
2022-03-18 23:15:02 -04:00
Terts Diepraam
337d257e8d
tests/sleep: fmt
2021-07-12 20:21:20 +02:00
Son Nguyen
6c26976edb
sleep: use UResult ( #2492 )
...
* sleep: use UResult in util
* sleep: add in error + test for it
* sleep: UResult - removed some verbosity
2021-07-12 20:20:23 +02:00
Andre Julius
53c3fedf33
sleep: Add more test cases
...
As mentioned here:
https://github.com/uutils/coreutils/pull/1777#discussion_r593807712
2021-03-15 14:36:38 +01:00
Andre Julius
2158b2c5b4
sleep: move from getopts to clap #1735 ( #1777 )
...
and Add some sleep test cases #1735
2021-03-13 23:11:11 +01:00
Roy Ivy III
1b3bb56e66
tests ~ add missing test_UTIL module files (with 'ToDO' comments)
...
- common_core utils
- additional 'windows' utils
- additional 'unix' utils
2020-06-02 11:25:09 -05:00