mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
l10n: port timeout for translation + add french
This commit is contained in:
parent
4128efad0f
commit
bd6f1cfbe5
3 changed files with 62 additions and 20 deletions
|
@ -1,2 +1,16 @@
|
||||||
timeout-about = Start COMMAND, and kill it if still running after DURATION.
|
timeout-about = Start COMMAND, and kill it if still running after DURATION.
|
||||||
timeout-usage = timeout [OPTION] DURATION COMMAND...
|
timeout-usage = timeout [OPTION] DURATION COMMAND...
|
||||||
|
|
||||||
|
# Help messages
|
||||||
|
timeout-help-foreground = when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out
|
||||||
|
timeout-help-kill-after = also send a KILL signal if COMMAND is still running this long after the initial signal was sent
|
||||||
|
timeout-help-preserve-status = exit with the same status as COMMAND, even when the command times out
|
||||||
|
timeout-help-signal = specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals
|
||||||
|
timeout-help-verbose = diagnose to stderr any signal sent upon timeout
|
||||||
|
|
||||||
|
# Error messages
|
||||||
|
timeout-error-invalid-signal = { $signal }: invalid signal
|
||||||
|
timeout-error-failed-to-execute-process = failed to execute process: { $error }
|
||||||
|
|
||||||
|
# Verbose messages
|
||||||
|
timeout-verbose-sending-signal = sending signal { $signal } to command { $command }
|
||||||
|
|
16
src/uu/timeout/locales/fr-FR.ftl
Normal file
16
src/uu/timeout/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
timeout-about = Démarrer COMMANDE, et la tuer si elle fonctionne encore après DURÉE.
|
||||||
|
timeout-usage = timeout [OPTION] DURÉE COMMANDE...
|
||||||
|
|
||||||
|
# Messages d'aide
|
||||||
|
timeout-help-foreground = quand on n'exécute pas timeout directement depuis une invite de shell, permettre à COMMANDE de lire depuis le TTY et d'obtenir les signaux TTY ; dans ce mode, les enfants de COMMANDE ne seront pas limités dans le temps
|
||||||
|
timeout-help-kill-after = envoyer aussi un signal KILL si COMMANDE fonctionne encore si longtemps après que le signal initial ait été envoyé
|
||||||
|
timeout-help-preserve-status = sortir avec le même statut que COMMANDE, même quand la commande dépasse le délai
|
||||||
|
timeout-help-signal = spécifier le signal à envoyer en cas de délai dépassé ; SIGNAL peut être un nom comme 'HUP' ou un nombre ; voir 'kill -l' pour une liste des signaux
|
||||||
|
timeout-help-verbose = diagnostiquer vers stderr tout signal envoyé lors d'un dépassement de délai
|
||||||
|
|
||||||
|
# Messages d'erreur
|
||||||
|
timeout-error-invalid-signal = { $signal } : signal invalide
|
||||||
|
timeout-error-failed-to-execute-process = échec d'exécution du processus : { $error }
|
||||||
|
|
||||||
|
# Messages détaillés
|
||||||
|
timeout-verbose-sending-signal = envoi du signal { $signal } à la commande { $command }
|
|
@ -8,6 +8,7 @@ mod status;
|
||||||
|
|
||||||
use crate::status::ExitStatus;
|
use crate::status::ExitStatus;
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
use std::os::unix::process::ExitStatusExt;
|
use std::os::unix::process::ExitStatusExt;
|
||||||
use std::process::{self, Child, Stdio};
|
use std::process::{self, Child, Stdio};
|
||||||
|
@ -17,7 +18,7 @@ use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
|
||||||
use uucore::parser::parse_time;
|
use uucore::parser::parse_time;
|
||||||
use uucore::process::ChildExt;
|
use uucore::process::ChildExt;
|
||||||
|
|
||||||
use uucore::locale::get_message;
|
use uucore::locale::{get_message, get_message_with_args};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use uucore::signals::enable_pipe_errors;
|
use uucore::signals::enable_pipe_errors;
|
||||||
|
|
||||||
|
@ -58,7 +59,13 @@ impl Config {
|
||||||
None => {
|
None => {
|
||||||
return Err(UUsageError::new(
|
return Err(UUsageError::new(
|
||||||
ExitStatus::TimeoutFailed.into(),
|
ExitStatus::TimeoutFailed.into(),
|
||||||
format!("{}: invalid signal", signal_.quote()),
|
get_message_with_args(
|
||||||
|
"timeout-error-invalid-signal",
|
||||||
|
HashMap::from([(
|
||||||
|
"signal".to_string(),
|
||||||
|
signal_.quote().to_string(),
|
||||||
|
)]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
Some(signal_value) => signal_value,
|
Some(signal_value) => signal_value,
|
||||||
|
@ -126,44 +133,34 @@ pub fn uu_app() -> Command {
|
||||||
Arg::new(options::FOREGROUND)
|
Arg::new(options::FOREGROUND)
|
||||||
.long(options::FOREGROUND)
|
.long(options::FOREGROUND)
|
||||||
.short('f')
|
.short('f')
|
||||||
.help(
|
.help(get_message("timeout-help-foreground"))
|
||||||
"when not running timeout directly from a shell prompt, allow \
|
|
||||||
COMMAND to read from the TTY and get TTY signals; in this mode, \
|
|
||||||
children of COMMAND will not be timed out",
|
|
||||||
)
|
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::KILL_AFTER)
|
Arg::new(options::KILL_AFTER)
|
||||||
.long(options::KILL_AFTER)
|
.long(options::KILL_AFTER)
|
||||||
.short('k')
|
.short('k')
|
||||||
.help(
|
.help(get_message("timeout-help-kill-after")),
|
||||||
"also send a KILL signal if COMMAND is still running this long \
|
|
||||||
after the initial signal was sent",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::PRESERVE_STATUS)
|
Arg::new(options::PRESERVE_STATUS)
|
||||||
.long(options::PRESERVE_STATUS)
|
.long(options::PRESERVE_STATUS)
|
||||||
.short('p')
|
.short('p')
|
||||||
.help("exit with the same status as COMMAND, even when the command times out")
|
.help(get_message("timeout-help-preserve-status"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::SIGNAL)
|
Arg::new(options::SIGNAL)
|
||||||
.short('s')
|
.short('s')
|
||||||
.long(options::SIGNAL)
|
.long(options::SIGNAL)
|
||||||
.help(
|
.help(get_message("timeout-help-signal"))
|
||||||
"specify the signal to be sent on timeout; SIGNAL may be a name like \
|
|
||||||
'HUP' or a number; see 'kill -l' for a list of signals",
|
|
||||||
)
|
|
||||||
.value_name("SIGNAL"),
|
.value_name("SIGNAL"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::VERBOSE)
|
Arg::new(options::VERBOSE)
|
||||||
.short('v')
|
.short('v')
|
||||||
.long(options::VERBOSE)
|
.long(options::VERBOSE)
|
||||||
.help("diagnose to stderr any signal sent upon timeout")
|
.help(get_message("timeout-help-verbose"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(Arg::new(options::DURATION).required(true))
|
.arg(Arg::new(options::DURATION).required(true))
|
||||||
|
@ -192,7 +189,16 @@ fn unblock_sigchld() {
|
||||||
fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) {
|
fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) {
|
||||||
if verbose {
|
if verbose {
|
||||||
let s = signal_name_by_value(signal).unwrap();
|
let s = signal_name_by_value(signal).unwrap();
|
||||||
show_error!("sending signal {s} to command {}", cmd.quote());
|
show_error!(
|
||||||
|
"{}",
|
||||||
|
get_message_with_args(
|
||||||
|
"timeout-verbose-sending-signal",
|
||||||
|
HashMap::from([
|
||||||
|
("signal".to_string(), s.to_string()),
|
||||||
|
("command".to_string(), cmd.quote().to_string())
|
||||||
|
])
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +321,13 @@ fn timeout(
|
||||||
// FIXME: this may not be 100% correct...
|
// FIXME: this may not be 100% correct...
|
||||||
126
|
126
|
||||||
};
|
};
|
||||||
USimpleError::new(status_code, format!("failed to execute process: {err}"))
|
USimpleError::new(
|
||||||
|
status_code,
|
||||||
|
get_message_with_args(
|
||||||
|
"timeout-error-failed-to-execute-process",
|
||||||
|
HashMap::from([("error".to_string(), err.to_string())]),
|
||||||
|
),
|
||||||
|
)
|
||||||
})?;
|
})?;
|
||||||
unblock_sigchld();
|
unblock_sigchld();
|
||||||
// Wait for the child process for the specified time period.
|
// Wait for the child process for the specified time period.
|
||||||
|
@ -364,7 +376,7 @@ fn timeout(
|
||||||
Ok(status) => Err(status.into()),
|
Ok(status) => Err(status.into()),
|
||||||
Err(e) => Err(USimpleError::new(
|
Err(e) => Err(USimpleError::new(
|
||||||
ExitStatus::TimeoutFailed.into(),
|
ExitStatus::TimeoutFailed.into(),
|
||||||
format!("{e}"),
|
e.to_string(),
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue