pub struct JavaRedirect { /* private fields */ }Expand description
I/O redirection options for a Java process.
Use the builder methods to specify files for stdout, stderr, and stdin. If a stream is not redirected, it will inherit the parent’s corresponding stream (i.e., print to console or read from keyboard).
Implementations§
Source§impl JavaRedirect
impl JavaRedirect
Sourcepub fn output(self, path: impl AsRef<Path>) -> Self
pub fn output(self, path: impl AsRef<Path>) -> Self
Redirects the Java process’s standard output to the given file. The file will be created (or truncated) before execution.
Sourcepub fn error(self, path: impl AsRef<Path>) -> Self
pub fn error(self, path: impl AsRef<Path>) -> Self
Redirects the Java process’s standard error to the given file. The file will be created (or truncated) before execution.
Sourcepub fn input(self, path: impl AsRef<Path>) -> Self
pub fn input(self, path: impl AsRef<Path>) -> Self
Redirects the Java process’s standard input from the given file. The file must exist and be readable.
Sourcepub fn append_output(self) -> Self
pub fn append_output(self) -> Self
Append to the output file instead of truncating.
Only has an effect when output is also set.
Sourcepub fn append_error(self) -> Self
pub fn append_error(self) -> Self
Append to the error file instead of truncating.
Only has an effect when error is also set.