Skip to content

Commit d9fed2b

Browse files
committed
Teach extra::term::Terminal.reset() to handle missing op
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.
1 parent 9b6dfb8 commit d9fed2b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/libextra/term.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Terminal {
9797
if s.is_ok() {
9898
self.out.write(s.unwrap());
9999
} else {
100-
warn!(s.unwrap_err());
100+
warn!("%s", s.unwrap_err());
101101
}
102102
}
103103
}
@@ -113,17 +113,20 @@ impl Terminal {
113113
if s.is_ok() {
114114
self.out.write(s.unwrap());
115115
} else {
116-
warn!(s.unwrap_err());
116+
warn!("%s", s.unwrap_err());
117117
}
118118
}
119119
}
120120
pub fn reset(&self) {
121121
let mut vars = Variables::new();
122-
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut vars);
122+
let s = do self.ti.strings.find_equiv(&("op"))
123+
.map_consume_default(Err(~"can't find op")) |&op| {
124+
expand(op, [], &mut vars)
125+
};
123126
if s.is_ok() {
124127
self.out.write(s.unwrap());
125128
} else {
126-
warn!(s.unwrap_err());
129+
warn!("%s", s.unwrap_err());
127130
}
128131
}
129132

0 commit comments

Comments
 (0)