diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-12-28 21:54:34 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-12-28 21:54:34 +0100 |
commit | 55edccaa6487e43200e0807bbe329f3aea40939f (patch) | |
tree | 4d0ca321ac1d22188f2bd99dafe33f87680dde41 | |
parent | e9ba15b5e9ed3cfcb57f5e5991e3f9fed496aa11 (diff) |
Revert "use Stdio::null instead of /dev/null"
This reverts commit e9ba15b5e9ed3cfcb57f5e5991e3f9fed496aa11.
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 3e0abb5..5e978d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,15 @@ use anyhow::bail; -use std::fs; +use std::fs::{self, File}; use std::io::{self, Write}; use std::os::fd::AsFd; -use std::process::{Command, Stdio}; +use std::process::Command; use std::thread; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; +fn null() -> anyhow::Result<File> { + Ok(File::open("/dev/null")?) +} + fn start() -> anyhow::Result<()> { let mut stdout = StandardStream::stdout(ColorChoice::Always); @@ -24,9 +28,7 @@ fn start() -> anyhow::Result<()> { } let mut cmd = Command::new(service.path()); - cmd.stderr(Stdio::null()) - .stdin(Stdio::null()) - .stdout(Stdio::null()); + cmd.stderr(null()?).stdin(null()?).stdout(null()?); match cmd.spawn() { Ok(_) => { |