serde_json = "1.0"
shell-escape = "0.1"
tar = { version = "0.4", default-features = false }
-tempdir = "0.3"
+tempfile = "3.0"
termcolor = "0.3"
toml = "0.4"
url = "1.1"
extern crate serde_json;
extern crate shell_escape;
extern crate tar;
-extern crate tempdir;
+extern crate tempfile;
extern crate termcolor;
extern crate toml;
extern crate url;
use std::sync::Arc;
use semver::{Version, VersionReq};
-use tempdir::TempDir;
+use tempfile::Builder as TempFileBuilder;
use toml;
use core::{Dependency, Package, PackageIdSpec, Source, SourceId};
None
} else if let Some(dir) = config.target_dir()? {
Some(dir)
- } else if let Ok(td) = TempDir::new("cargo-install") {
+ } else if let Ok(td) = TempFileBuilder::new().prefix("cargo-install").tempdir() {
let p = td.path().to_owned();
td_opt = Some(td);
Some(Filesystem::new(p))
// Copy all binaries to a temporary directory under `dst` first, catching
// some failure modes (e.g. out of space) before touching the existing
// binaries. This directory will get cleaned up via RAII.
- let staging_dir = TempDir::new_in(&dst, "cargo-install")?;
+ let staging_dir = TempFileBuilder::new()
+ .prefix("cargo-install")
+ .tempdir_in(&dst)?;
for &(bin, src) in binaries.iter() {
let dst = staging_dir.path().join(bin);
// Try to move if `target_dir` is transient.
use cargotest::support::registry::Package;
use cargotest::ChannelChanger;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
-use tempdir::TempDir;
+use tempfile;
#[test]
fn cargo_compile_simple() {
#[test]
fn cargo_compile_without_manifest() {
- let tmpdir = TempDir::new("cargo").unwrap();
+ let tmpdir = tempfile::Builder::new().prefix("cargo").tempdir().unwrap();
let p = ProjectBuilder::new("foo", tmpdir.path().to_path_buf()).build();
assert_that(
use cargo::util::ProcessBuilder;
use cargotest::support::{cargo_exe, execs, paths};
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
-use tempdir::TempDir;
+use tempfile;
fn cargo_process(s: &str) -> ProcessBuilder {
let mut p = cargotest::process(&cargo_exe());
#[test]
fn both_lib_and_bin() {
- let td = TempDir::new("cargo").unwrap();
+ let td = tempfile::Builder::new().prefix("cargo").tempdir().unwrap();
assert_that(
cargo_process("init")
.arg("--lib")
#[test]
fn auto_git() {
- let td = TempDir::new("cargo").unwrap();
+ let td = tempfile::Builder::new().prefix("cargo").tempdir().unwrap();
let foo = &td.path().join("foo");
fs::create_dir_all(&foo).unwrap();
assert_that(
#[macro_use]
extern crate serde_json;
extern crate tar;
-extern crate tempdir;
+extern crate tempfile;
extern crate toml;
extern crate url;
#[cfg(windows)]
use cargotest::process;
use cargotest::support::{execs, paths};
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
-use tempdir::TempDir;
+use tempfile;
fn cargo_process(s: &str) -> ProcessBuilder {
let mut p = cargotest::cargo_process();
// Run inside a temp directory so that cargo will initialize a git repo.
// If this ran inside paths::root() it would detect that we are already
// inside a git repo and skip the initialization.
- let td = TempDir::new("cargo").unwrap();
+ let td = tempfile::Builder::new().prefix("cargo").tempdir().unwrap();
assert_that(
cargo_process("new")
.arg("--lib")