From: Yehuda Katz Date: Fri, 9 May 2014 00:50:10 +0000 (-0700) Subject: Add Show to ProcessBuilder X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~1069 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ecf4f37f5ead1df68423f94cbdae937d0bebda9f;p=cargo.git Add Show to ProcessBuilder --- diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 4356dcab6..1740c9a4a 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -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 = ":";