mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 13:58:28 +00:00
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:
@@ -24,7 +24,7 @@ fnv = "1.0.7"
|
||||
lazy_static = "1.4.0"
|
||||
lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
|
||||
smallvec = "1.4.2"
|
||||
tokio-io-timeout = "0.5.0"
|
||||
tokio-io-timeout = "0.5.0"
|
||||
lru = "0.6.0"
|
||||
parking_lot = "0.11.0"
|
||||
sha2 = "0.9.1"
|
||||
@@ -50,7 +50,7 @@ features = ["websocket", "identify", "mplex", "yamux", "noise", "gossipsub", "dn
|
||||
tokio = { version = "0.3.2", features = ["full"] }
|
||||
slog-term = "2.6.0"
|
||||
slog-async = "2.5.0"
|
||||
tempdir = "0.3.7"
|
||||
tempfile = "3.1.0"
|
||||
exit-future = "0.2.0"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -13,7 +13,7 @@ use tokio::runtime::Runtime;
|
||||
use types::{ChainSpec, EnrForkId, MinimalEthSpec};
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::Builder as TempBuilder;
|
||||
|
||||
pub struct Libp2pInstance(LibP2PService<E>, exit_future::Signal);
|
||||
|
||||
@@ -76,7 +76,10 @@ pub fn unused_port(transport: &str) -> Result<u16, String> {
|
||||
|
||||
pub fn build_config(port: u16, mut boot_nodes: Vec<Enr>) -> NetworkConfig {
|
||||
let mut config = NetworkConfig::default();
|
||||
let path = TempDir::new(&format!("libp2p_test{}", port)).unwrap();
|
||||
let path = TempBuilder::new()
|
||||
.prefix(&format!("libp2p_test{}", port))
|
||||
.tempdir()
|
||||
.unwrap();
|
||||
|
||||
config.libp2p_port = port; // tcp port
|
||||
config.discovery_port = port; // udp port
|
||||
|
||||
Reference in New Issue
Block a user