Skip to content

Commit a0915a2

Browse files
The fix now uses libc::time_t::MAX
1 parent 0a154ce commit a0915a2

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test Timeout on macOS
2+
3+
on:
4+
push:
5+
branches:
6+
- fix-timeout-performance
7+
workflow_dispatch:
8+
9+
jobs:
10+
test-macos:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rust
16+
uses: dtolnay/rust-toolchain@stable
17+
18+
- name: Build timeout
19+
run: cargo build --release -p uu_timeout
20+
21+
- name: Run timeout tests
22+
run: cargo test --test tests test_timeout -- --nocapture
23+
24+
- name: Test overflow case directly
25+
run: |
26+
./target/release/timeout 9223372036854775808d sleep 0
27+
echo "Exit code: $?"

src/uu/timeout/src/timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl Config {
105105
};
106106

107107
if num > max_safe as u128 {
108-
Duration::from_secs(i64::MAX as u64)
108+
Duration::from_secs(libc::time_t::MAX as u64)
109109
} else {
110110
let secs = (num as u64) * multiplier;
111111
Duration::from_secs(secs)

0 commit comments

Comments
 (0)