Skip to content

Instantly share code, notes, and snippets.

@oconnor663
Created November 11, 2021 16:49
Show Gist options
  • Select an option

  • Save oconnor663/4b7b58a23b14292b026fdf2be3ed3ceb to your computer and use it in GitHub Desktop.

Select an option

Save oconnor663/4b7b58a23b14292b026fdf2be3ed3ceb to your computer and use it in GitHub Desktop.
const PYTHON_PROGRAM: &str = r#"
import sys
print("something for stdout")
print("something for stderr", file=sys.stderr)
"#;
fn main() {
let logf = std::fs::File::create("logfile.txt").unwrap();
duct::cmd!("python", "-c", PYTHON_PROGRAM)
.stderr_to_stdout()
.unchecked()
.stdout_file(logf)
.run()
.unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment