Revert "Downgrade term crate back down to 0.2 (from 0.4)."
authorSteven Allen <steven@stebalien.com>
Sat, 30 Jan 2016 20:30:53 +0000 (15:30 -0500)
committerSteven Allen <steven@stebalien.com>
Sat, 30 Jan 2016 20:30:53 +0000 (15:30 -0500)
This reverts commit 75e0371ba0cd8ca235dea4e4178cf4c88dbf2e74.

Cargo.lock
Cargo.toml
src/cargo/core/shell.rs
src/cargo/util/errors.rs

index ee26f7e1ff42265e2dd56ffbb59ee464ea5a8cf8..a2d750066d9dd87b60df38c78b07c74b27ed941c 100644 (file)
@@ -25,7 +25,7 @@ dependencies = [
  "semver 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "tar 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -395,7 +395,7 @@ dependencies = [
 
 [[package]]
 name = "term"
-version = "0.2.14"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
index 5e3c52d590b3c802ac3175d46c8a4f5e5b603fd7..ed3e7cb8e973e9de29b0a1f452bb3c6b3a8f74fb 100644 (file)
@@ -37,7 +37,7 @@ regex = "0.1"
 rustc-serialize = "0.3"
 semver = "0.2.0"
 tar = "0.4"
-term = "0.2"
+term = "0.4"
 time = "0.1"
 toml = "0.1"
 url = "0.2"
index cc764dcb664827505aa81e04a95e4fd2fdc751d4..14cc5f38794d44b6e83dfdc078224ebc8e835723 100644 (file)
@@ -3,7 +3,7 @@ use std::io::prelude::*;
 use std::io;
 
 use term::color::{Color, BLACK, RED, GREEN, YELLOW};
-use term::{Terminal, TerminfoTerminal, color, Attr};
+use term::{self, Terminal, TerminfoTerminal, color, Attr};
 
 use self::AdequateTerminal::{NoColor, Colored};
 use self::Verbosity::{Verbose, Normal, Quiet};
@@ -193,22 +193,24 @@ impl Shell {
         Ok(())
     }
 
-    fn fg(&mut self, color: color::Color) -> io::Result<bool> {
+    fn fg(&mut self, color: color::Color) -> CargoResult<bool> {
         let colored = self.colored();
 
         match self.terminal {
-            Colored(ref mut c) if colored => c.fg(color),
-            _ => Ok(false),
+            Colored(ref mut c) if colored => try!(c.fg(color)),
+            _ => return Ok(false),
         }
+        Ok(true)
     }
 
-    fn attr(&mut self, attr: Attr) -> io::Result<bool> {
+    fn attr(&mut self, attr: Attr) -> CargoResult<bool> {
         let colored = self.colored();
 
         match self.terminal {
-            Colored(ref mut c) if colored => c.attr(attr),
-            _ => Ok(false)
+            Colored(ref mut c) if colored => try!(c.attr(attr)),
+            _ => return Ok(false)
         }
+        Ok(true)
     }
 
     fn supports_attr(&self, attr: Attr) -> bool {
@@ -220,13 +222,14 @@ impl Shell {
         }
     }
 
-    fn reset(&mut self) -> io::Result<()> {
+    fn reset(&mut self) -> term::Result<()> {
         let colored = self.colored();
 
         match self.terminal {
-            Colored(ref mut c) if colored => c.reset().map(|_| ()),
-            _ => Ok(())
+            Colored(ref mut c) if colored => try!(c.reset()),
+            _ => ()
         }
+        Ok(())
     }
 
     fn colored(&self) -> bool {
index e2ba109f3b20a6b17ec42825b3bbe3e7a97ed2ad..54934e10baa099f14c7f4281bfe045c5d23653ad 100644 (file)
@@ -9,6 +9,7 @@ use curl;
 use git2;
 use rustc_serialize::json;
 use semver;
+use term;
 use toml;
 use url;
 
@@ -306,6 +307,7 @@ from_error! {
     url::ParseError,
     toml::DecodeError,
     ffi::NulError,
+    term::Error,
 }
 
 impl<E: CargoError> From<Human<E>> for Box<CargoError> {
@@ -325,6 +327,7 @@ impl CargoError for toml::Error {}
 impl CargoError for toml::DecodeError {}
 impl CargoError for url::ParseError {}
 impl CargoError for ffi::NulError {}
+impl CargoError for term::Error {}
 
 // =============================================================================
 // Construction helpers