diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-25 17:04:37 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-03 15:15:42 -0800 |
| commit | 9c1851019f1ef9511fa8731b8f1acb0796d1e97f (patch) | |
| tree | 0cd6d600bfc077e1d19722afdb042c9c016db621 /src/librustpkg/source_control.rs | |
| parent | 7bf58c2baaac3f7cb3c8e8d735b27ac9e7d3cd78 (diff) | |
| download | rust-9c1851019f1ef9511fa8731b8f1acb0796d1e97f.tar.gz rust-9c1851019f1ef9511fa8731b8f1acb0796d1e97f.zip | |
Remove all blocking std::os blocking functions
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
Diffstat (limited to 'src/librustpkg/source_control.rs')
| -rw-r--r-- | src/librustpkg/source_control.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs index c3e4205dfc9..a0e50ff0f9e 100644 --- a/src/librustpkg/source_control.rs +++ b/src/librustpkg/source_control.rs @@ -10,8 +10,9 @@ // Utils for working with version control repositories. Just git right now. -use std::{os, run, str}; +use std::{run, str}; use std::run::{ProcessOutput, ProcessOptions, Process}; +use std::rt::io::file; use extra::tempfile::TempDir; use version::*; use path_util::chmod_read_only; @@ -22,14 +23,14 @@ use path_util::chmod_read_only; /// directory (that the callee may use, for example, to check out remote sources into). /// Returns `CheckedOutSources` if the clone succeeded. pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult { - if os::path_exists(source) { + if source.exists() { debug!("{} exists locally! Cloning it into {}", source.display(), target.display()); // Ok to use target here; we know it will succeed - assert!(os::path_is_dir(source)); + assert!(source.is_dir()); assert!(is_git_dir(source)); - if !os::path_exists(target) { + if !target.exists() { debug!("Running: git clone {} {}", source.display(), target.display()); // FIXME (#9639): This needs to handle non-utf8 paths let outp = run::process_output("git", [~"clone", @@ -95,8 +96,8 @@ pub enum CloneResult { pub fn make_read_only(target: &Path) { // Now, make all the files in the target dir read-only - do os::walk_dir(target) |p| { - if !os::path_is_dir(p) { + do file::walk_dir(target) |p| { + if !p.is_dir() { assert!(chmod_read_only(p)); }; true @@ -138,5 +139,5 @@ fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput } pub fn is_git_dir(p: &Path) -> bool { - os::path_is_dir(&p.join(".git")) + p.join(".git").is_dir() } |
