Rename str::from_bytes to str::from_utf8, closes #8985
This commit is contained in:
parent
422dcbd56d
commit
de39874801
38 changed files with 147 additions and 147 deletions
|
|
@ -153,7 +153,7 @@ impl<'self> PkgScript<'self> {
|
|||
exe.to_str(), sysroot.to_str(), "configs");
|
||||
let output = run::process_output(exe.to_str(), [sysroot.to_str(), ~"configs"]);
|
||||
// Run the configs() function to get the configs
|
||||
let cfgs = str::from_bytes_slice(output.output).word_iter()
|
||||
let cfgs = str::from_utf8_slice(output.output).word_iter()
|
||||
.map(|w| w.to_owned()).collect();
|
||||
(cfgs, output.status)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
|||
debug!("Running: git clone %s %s", source.to_str(), target.to_str());
|
||||
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
|
||||
if outp.status != 0 {
|
||||
io::println(str::from_bytes_owned(outp.output.clone()));
|
||||
io::println(str::from_bytes_owned(outp.error));
|
||||
io::println(str::from_utf8_owned(outp.output.clone()));
|
||||
io::println(str::from_utf8_owned(outp.error));
|
||||
fail!("Couldn't `git clone` %s", source.to_str());
|
||||
}
|
||||
else {
|
||||
|
|
@ -36,8 +36,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
|||
fmt!("--git-dir=%s", target.push(".git").to_str()),
|
||||
~"checkout", fmt!("%s", *s)]);
|
||||
if outp.status != 0 {
|
||||
io::println(str::from_bytes_owned(outp.output.clone()));
|
||||
io::println(str::from_bytes_owned(outp.error));
|
||||
io::println(str::from_utf8_owned(outp.output.clone()));
|
||||
io::println(str::from_utf8_owned(outp.error));
|
||||
fail!("Couldn't `git checkout %s` in %s",
|
||||
*s, target.to_str());
|
||||
}
|
||||
|
|
@ -64,8 +64,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
|||
pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
|
||||
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
|
||||
if outp.status != 0 {
|
||||
debug!(str::from_bytes_owned(outp.output.clone()));
|
||||
debug!(str::from_bytes_owned(outp.error));
|
||||
debug!(str::from_utf8_owned(outp.output.clone()));
|
||||
debug!(str::from_utf8_owned(outp.error));
|
||||
false
|
||||
}
|
||||
else {
|
||||
|
|
@ -74,8 +74,8 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
|
|||
let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)],
|
||||
target);
|
||||
if outp.status != 0 {
|
||||
debug!(str::from_bytes_owned(outp.output.clone()));
|
||||
debug!(str::from_bytes_owned(outp.error));
|
||||
debug!(str::from_utf8_owned(outp.output.clone()));
|
||||
debug!(str::from_utf8_owned(outp.error));
|
||||
false
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &st
|
|||
let rslt = prog.finish_with_output();
|
||||
if rslt.status != 0 {
|
||||
fail!("%s [git returned %?, output = %s, error = %s]", err_msg,
|
||||
rslt.status, str::from_bytes(rslt.output), str::from_bytes(rslt.error));
|
||||
rslt.status, str::from_utf8(rslt.output), str::from_utf8(rslt.error));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,8 +230,8 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s
|
|||
});
|
||||
let output = prog.finish_with_output();
|
||||
debug!("Output from command %s with args %? was %s {%s}[%?]",
|
||||
cmd, args, str::from_bytes(output.output),
|
||||
str::from_bytes(output.error),
|
||||
cmd, args, str::from_utf8(output.output),
|
||||
str::from_utf8(output.error),
|
||||
output.status);
|
||||
/*
|
||||
By the way, rustpkg *won't* return a nonzero exit code if it fails --
|
||||
|
|
@ -242,7 +242,7 @@ to make sure the command succeeded
|
|||
if output.status != 0 {
|
||||
fail!("Command %s %? failed with exit code %?; its output was {{{ %s }}}",
|
||||
cmd, args, output.status,
|
||||
str::from_bytes(output.output) + str::from_bytes(output.error));
|
||||
str::from_utf8(output.output) + str::from_utf8(output.error));
|
||||
}
|
||||
output
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ fn built_library_exists(repo: &Path, short_name: &str) -> bool {
|
|||
fn command_line_test_output(args: &[~str]) -> ~[~str] {
|
||||
let mut result = ~[];
|
||||
let p_output = command_line_test(args, &os::getcwd());
|
||||
let test_output = str::from_bytes(p_output.output);
|
||||
let test_output = str::from_utf8(p_output.output);
|
||||
for s in test_output.split_iter('\n') {
|
||||
result.push(s.to_owned());
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ fn command_line_test_output(args: &[~str]) -> ~[~str] {
|
|||
fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~str] {
|
||||
let mut result = ~[];
|
||||
let p_output = command_line_test_with_env(args, &os::getcwd(), Some(env));
|
||||
let test_output = str::from_bytes(p_output.output);
|
||||
let test_output = str::from_utf8(p_output.output);
|
||||
for s in test_output.split_iter('\n') {
|
||||
result.push(s.to_owned());
|
||||
}
|
||||
|
|
@ -985,7 +985,7 @@ fn test_info() {
|
|||
let expected_info = ~"package foo"; // fill in
|
||||
let workspace = create_local_package(&PkgId::new("foo"));
|
||||
let output = command_line_test([~"info", ~"foo"], &workspace);
|
||||
assert_eq!(str::from_bytes(output.output), expected_info);
|
||||
assert_eq!(str::from_utf8(output.output), expected_info);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -994,7 +994,7 @@ fn test_rustpkg_test() {
|
|||
let expected_results = ~"1 out of 1 tests passed"; // fill in
|
||||
let workspace = create_local_package_with_test(&PkgId::new("foo"));
|
||||
let output = command_line_test([~"test", ~"foo"], &workspace);
|
||||
assert_eq!(str::from_bytes(output.output), expected_results);
|
||||
assert_eq!(str::from_utf8(output.output), expected_results);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1004,7 +1004,7 @@ fn test_uninstall() {
|
|||
let _output = command_line_test([~"info", ~"foo"], &workspace);
|
||||
command_line_test([~"uninstall", ~"foo"], &workspace);
|
||||
let output = command_line_test([~"list"], &workspace);
|
||||
assert!(!str::from_bytes(output.output).contains("foo"));
|
||||
assert!(!str::from_utf8(output.output).contains("foo"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1073,8 +1073,8 @@ fn test_extern_mod() {
|
|||
let outp = prog.finish_with_output();
|
||||
if outp.status != 0 {
|
||||
fail!("output was %s, error was %s",
|
||||
str::from_bytes(outp.output),
|
||||
str::from_bytes(outp.error));
|
||||
str::from_utf8(outp.output),
|
||||
str::from_utf8(outp.error));
|
||||
}
|
||||
assert!(os::path_exists(&exec_file) && is_executable(&exec_file));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> {
|
|||
}
|
||||
|
||||
let mut output = None;
|
||||
let output_text = str::from_bytes(outp.output);
|
||||
let output_text = str::from_utf8(outp.output);
|
||||
for l in output_text.line_iter() {
|
||||
if !l.is_whitespace() {
|
||||
output = Some(l);
|
||||
|
|
@ -141,15 +141,15 @@ pub fn try_getting_version(remote_path: &Path) -> Option<Version> {
|
|||
tmp_dir.to_str()]);
|
||||
if outp.status == 0 {
|
||||
debug!("Cloned it... ( %s, %s )",
|
||||
str::from_bytes(outp.output),
|
||||
str::from_bytes(outp.error));
|
||||
str::from_utf8(outp.output),
|
||||
str::from_utf8(outp.error));
|
||||
let mut output = None;
|
||||
debug!("(getting version, now getting tags) executing {git --git-dir=%s tag -l}",
|
||||
tmp_dir.push(".git").to_str());
|
||||
let outp = run::process_output("git",
|
||||
[fmt!("--git-dir=%s", tmp_dir.push(".git").to_str()),
|
||||
~"tag", ~"-l"]);
|
||||
let output_text = str::from_bytes(outp.output);
|
||||
let output_text = str::from_utf8(outp.output);
|
||||
debug!("Full output: ( %s ) [%?]", output_text, outp.status);
|
||||
for l in output_text.line_iter() {
|
||||
debug!("A line of output: %s", l);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue