about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-28 07:40:57 -0700
committerbors <bors@rust-lang.org>2013-06-28 07:40:57 -0700
commit4e4e2f70c90f01b5be22a192c883b9dcb34df7ff (patch)
treebc5c0b5c72681ee5e92775f43ba74f73924c1fcc /src
parent811e045c609f8f6bc53faeec817e9ba7aeadf056 (diff)
parentd9fed2b06f0850fa9e2455e98606644d5d54757f (diff)
downloadrust-4e4e2f70c90f01b5be22a192c883b9dcb34df7ff.tar.gz
rust-4e4e2f70c90f01b5be22a192c883b9dcb34df7ff.zip
auto merge of #7436 : kballard/rust/term-dumb, r=cmr
Unlike fg() and bg(), we haven't already checked for the presence of
"op" in the terminfo when we call reset(), so we need to handle the case
where it's missing.

Also update the warn!() lines to avoid double-quoting the output.

Fixes #7431.
Diffstat (limited to 'src')
-rw-r--r--src/libextra/term.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libextra/term.rs b/src/libextra/term.rs
index 9a4469cb526..880b89f2bbe 100644
--- a/src/libextra/term.rs
+++ b/src/libextra/term.rs
@@ -97,7 +97,7 @@ impl Terminal {
             if s.is_ok() {
                 self.out.write(s.unwrap());
             } else {
-                warn!(s.unwrap_err());
+                warn!("%s", s.unwrap_err());
             }
         }
     }
@@ -113,17 +113,20 @@ impl Terminal {
             if s.is_ok() {
                 self.out.write(s.unwrap());
             } else {
-                warn!(s.unwrap_err());
+                warn!("%s", s.unwrap_err());
             }
         }
     }
     pub fn reset(&self) {
         let mut vars = Variables::new();
-        let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut vars);
+        let s = do self.ti.strings.find_equiv(&("op"))
+                       .map_consume_default(Err(~"can't find op")) |&op| {
+                           expand(op, [], &mut vars)
+                       };
         if s.is_ok() {
             self.out.write(s.unwrap());
         } else {
-            warn!(s.unwrap_err());
+            warn!("%s", s.unwrap_err());
         }
     }