Add Show to ProcessBuilder

This commit is contained in:
Yehuda Katz 2014-05-08 17:50:10 -07:00
parent b3c2350325
commit ecf4f37f5e

View file

@ -1,3 +1,5 @@
use std::fmt;
use std::fmt::{Show,Formatter};
use std::os;
use std::path::Path;
use std::io;
@ -13,6 +15,18 @@ pub struct ProcessBuilder {
cwd: Path
}
impl Show for ProcessBuilder {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
try!(write!(f.buf, "`{}", self.program));
if self.args.len() > 0 {
try!(write!(f.buf, " {}", self.args.connect(" ")));
}
write!(f.buf, "`")
}
}
// TODO: Upstream a Windows/Posix branch to Rust proper
static PATH_SEP : &'static str = ":";