mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
22 lines
664 B
Rust
22 lines
664 B
Rust
use std::path::PathBuf;
|
|
use std::{os::unix::prelude::CommandExt, process::Command};
|
|
use std::fs::File;
|
|
|
|
|
|
pub trait NeonCommandExtensions: CommandExt {
|
|
fn capture_to_files(&mut self, path: PathBuf, name: &str) -> &mut Command;
|
|
}
|
|
|
|
impl NeonCommandExtensions for Command {
|
|
fn capture_to_files(&mut self, path: PathBuf, name: &str) -> &mut Command {
|
|
let out_file = File::create(path.join(format!("{}.out", name)))
|
|
.expect("can't make file");
|
|
let err_file = File::create(path.join(format!("{}.out", name)))
|
|
.expect("can't make file");
|
|
|
|
// TODO touch files?
|
|
|
|
self.stdout(out_file).stderr(err_file)
|
|
}
|
|
}
|