replace tempdir by tempfile (#2143)

## Issue Addressed

Fixes #2141 
Remove [tempdir](https://docs.rs/tempdir/0.3.7/tempdir/) in favor of [tempfile](https://docs.rs/tempfile/3.1.0/tempfile/).

## Proposed Changes

`tempfile` has a slightly different api that makes creating temp folders with a name prefix a chore (`tempdir::TempDir::new("toto")` => `tempfile::Builder::new().prefix("toto").tempdir()`).

So I removed temp folder name prefix where I deemed it not useful.

Otherwise, the functionality is the same.
This commit is contained in:
Arthur Woimbée
2021-01-06 06:36:11 +00:00
parent 7e4b190df0
commit 851a4dca3c
21 changed files with 64 additions and 74 deletions

View File

@@ -5,7 +5,7 @@ pub use local_signer_test_data::*;
use remote_signer_client::Client;
use serde_json::Value;
use std::collections::HashMap;
use tempdir::TempDir;
use tempfile::{Builder as TempBuilder, TempDir};
use types::EthSpec;
pub struct ApiTestSigner<E: EthSpec> {
@@ -81,7 +81,10 @@ pub fn get_environment(is_log_active: bool) -> Environment<E> {
}
pub fn set_up_api_test_signer_raw_dir() -> (ApiTestSigner<E>, TempDir) {
let tmp_dir = TempDir::new("bls-remote-signer-test").unwrap();
let tmp_dir = TempBuilder::new()
.prefix("bls-remote-signer-test")
.tempdir()
.unwrap();
let arg_vec = vec![
"this_test",
"--port",

View File

@@ -11,7 +11,7 @@ use std::io::Write;
use std::net::IpAddr::{V4, V6};
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
use tempdir::TempDir;
use tempfile::TempDir;
use types::{
AggregateSignature, Attestation, AttestationData, AttesterSlashing, BeaconBlock,
BeaconBlockHeader, BitList, Checkpoint, Deposit, DepositData, Epoch, EthSpec, FixedVector,