This commit is contained in:
Adrian Heine 2021-08-01 21:21:22 +02:00
parent d6d5d9ebc4
commit 5ca1e45b66
7 changed files with 22 additions and 16 deletions

View file

@ -36,12 +36,11 @@ impl<S: AsRef<Path>, U: AsRef<str>, R: CommandRunner> UserService<'_, S, U, R> {
let result = self.command_runner.run_with_args("systemctl", args).await?;
if result.status.success() {
return Ok(String::from_utf8(result.stdout)?.trim_end().to_string());
} else {
let raw_stderr = String::from_utf8(result.stderr)?;
let stderr = raw_stderr.trim_end();
if stderr != "Failed to connect to bus: No such file or directory" {
return Err(stderr.into());
}
}
let raw_stderr = String::from_utf8(result.stderr)?;
let stderr = raw_stderr.trim_end();
if stderr != "Failed to connect to bus: No such file or directory" {
return Err(stderr.into());
}
tries -= 1;
if tries == 0 {