Skip to content

Commit 5723f3d

Browse files
committed
timeout: cleanups
1 parent fce87eb commit 5723f3d

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Because it is a FAQ, the major differences between this project and uutils are:
101101
- [x] strip (Development)
102102
- [x] tail
103103
- [x] time
104+
- [x] timeout
104105
- [x] tr
105106
- [x] true
106107
- [x] uncompress (compress cat.)
@@ -218,7 +219,6 @@ Because it is a FAQ, the major differences between this project and uutils are:
218219
- [ ] sed
219220
- [ ] sh -- Volunteer starting point at https://github.com/rustcoreutils/posixutils-rs/tree/shell
220221
- [ ] talk (status: in progress)
221-
- [ ] timeout (status: in progress)
222222

223223
## Installation
224224

process/timeout.rs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99

1010
use clap::Parser;
11-
use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory};
11+
use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory};
1212
use plib::PROJECT_NAME;
1313
use std::{
1414
error::Error,
@@ -102,39 +102,28 @@ static KILL_AFTER: Mutex<Option<Duration>> = Mutex::new(None);
102102
static MONITORED_PID: AtomicI32 = AtomicI32::new(0);
103103
static TIMED_OUT: AtomicBool = AtomicBool::new(false);
104104

105-
/// timeout — execute a utility with a time limit
106105
#[derive(Parser)]
107-
#[command(version, about)]
106+
#[command(version, about = gettext("timeout — execute a utility with a time limit"))]
108107
struct Args {
109-
/// Only time out the utility itself, not its descendants.
110-
#[arg(short = 'f', long)]
108+
#[arg(short = 'f', long, help=gettext("Only time out the utility itself, not its descendants."))]
111109
foreground: bool,
112110

113-
/// Always preserve (mimic) the wait status of the executed utility, even if the time limit was reached.
114-
#[arg(short = 'p', long)]
111+
#[arg(short = 'p', long, help=gettext("Preserve the exit status of the utility."))]
115112
preserve_status: bool,
116113

117-
/// Send a SIGKILL signal if the child process created to execute the utility has not terminated after the time period
118-
/// specified by time has elapsed since the first signal was sent. The value of time shall be interpreted as specified for
119-
/// the duration operand.
120-
#[arg(short = 'k', long, value_parser = parse_duration)]
114+
#[arg(short = 'k', long, value_parser = parse_duration, help=gettext("Send a SIGKILL signal if the child process has not terminated after the time period."))]
121115
kill_after: Option<Duration>,
122116

123-
/// Specify the signal to send when the time limit is reached, using one of the symbolic names defined in the <signal.h> header.
124-
/// Values of signal shall be recognized in a case-independent fashion, without the SIG prefix. By default, SIGTERM shall be sent.
125-
#[arg(short = 's', long, default_value = "TERM", value_parser = parse_signal)]
117+
#[arg(short = 's', long, default_value = "TERM", value_parser = parse_signal, help=gettext("Specify the signal to send when the time limit is reached."))]
126118
signal_name: i32,
127119

128-
/// The maximum amount of time to allow the utility to run, specified as a decimal number with an optional decimal fraction and an optional suffix.
129-
#[arg(name = "DURATION", value_parser = parse_duration)]
120+
#[arg(name = "DURATION", value_parser = parse_duration, help=gettext("The maximum amount of time to allow the utility to run, specified as a decimal number with an optional decimal fraction and an optional suffix."))]
130121
duration: Duration,
131122

132-
/// The name of a utility that is to be executed.
133-
#[arg(name = "UTILITY")]
123+
#[arg(name = "UTILITY", help=gettext("The utility to execute."))]
134124
utility: String,
135125

136-
/// Any string to be supplied as an argument when executing the utility named by the utility operand.
137-
#[arg(name = "ARGUMENT", trailing_var_arg = true)]
126+
#[arg(name = "ARGUMENT", trailing_var_arg = true, help=gettext("Arguments to pass to the utility."))]
138127
arguments: Vec<String>,
139128
}
140129

0 commit comments

Comments
 (0)