From a82a4546bb9ae605cb46260d321f962be612cd8c Mon Sep 17 00:00:00 2001 From: Sebastian Tia Date: Tue, 23 Jan 2024 16:40:44 -0500 Subject: [PATCH 1/4] fix --- src/config/compiler.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config/compiler.rs b/src/config/compiler.rs index adcc5360eddaf..ca19d4f008bd8 100644 --- a/src/config/compiler.rs +++ b/src/config/compiler.rs @@ -17,7 +17,8 @@ use fs4::FileExt; fn create_data_dir_lock(data_dir: &Option) -> Result, String> { if let Some(data_dir) = data_dir { let lock_path = data_dir.join(".lock"); - let lock = File::create(&lock_path).map_err(|e| e.to_string())?; + let lock = File::create(&lock_path) + .map_err(|e| format!("Couldn't create lockfile at {lock_path:?}. Error: {e}"))?; match lock.try_lock_exclusive() { Ok(()) => Ok(Some(lock)), Err(e) => Err(format!("Couldn't lock {lock_path:?}. Error: {e}")), @@ -124,10 +125,13 @@ pub fn compile(mut builder: ConfigBuilder) -> Result<(Config, Vec), Vec< .into_iter() .map(|test| test.resolve_outputs(&graph)) .collect::, Vec<_>>>()?; + println!("tets"); + println!("Seb test {:?}", &global.data_dir); let data_dir_lock = match create_data_dir_lock(&global.data_dir) { Ok(lock) => lock, Err(e) => { + println!("Seb test 2 {}", e); errors.push(e); None } From b7f86e679ef74d304f562decc444a25b05dfb887 Mon Sep 17 00:00:00 2001 From: Sebastian Tia Date: Tue, 23 Jan 2024 16:42:31 -0500 Subject: [PATCH 2/4] cleanup --- src/config/compiler.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/config/compiler.rs b/src/config/compiler.rs index ca19d4f008bd8..8fef12ea1375c 100644 --- a/src/config/compiler.rs +++ b/src/config/compiler.rs @@ -125,13 +125,10 @@ pub fn compile(mut builder: ConfigBuilder) -> Result<(Config, Vec), Vec< .into_iter() .map(|test| test.resolve_outputs(&graph)) .collect::, Vec<_>>>()?; - println!("tets"); - println!("Seb test {:?}", &global.data_dir); let data_dir_lock = match create_data_dir_lock(&global.data_dir) { Ok(lock) => lock, Err(e) => { - println!("Seb test 2 {}", e); errors.push(e); None } From 27296265e32f5130c0bd88c614eceaecf9e2f351 Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Tue, 23 Jan 2024 20:42:23 -0500 Subject: [PATCH 3/4] Update src/config/compiler.rs Co-authored-by: Jesse Szwedko --- src/config/compiler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/compiler.rs b/src/config/compiler.rs index 8fef12ea1375c..e307ae3c5916f 100644 --- a/src/config/compiler.rs +++ b/src/config/compiler.rs @@ -18,7 +18,7 @@ fn create_data_dir_lock(data_dir: &Option) -> Result, Stri if let Some(data_dir) = data_dir { let lock_path = data_dir.join(".lock"); let lock = File::create(&lock_path) - .map_err(|e| format!("Couldn't create lockfile at {lock_path:?}. Error: {e}"))?; + .map_err(|e| format!("Couldn't create lockfile for the data directory at {lock_path:?}. Error: {e}"))?; match lock.try_lock_exclusive() { Ok(()) => Ok(Some(lock)), Err(e) => Err(format!("Couldn't lock {lock_path:?}. Error: {e}")), From 2dd22e9c76338d19e547285d4ce22e236b499b20 Mon Sep 17 00:00:00 2001 From: Sebastian Tia Date: Wed, 24 Jan 2024 09:15:47 -0500 Subject: [PATCH 4/4] format --- src/config/compiler.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config/compiler.rs b/src/config/compiler.rs index e307ae3c5916f..f97c43e160c31 100644 --- a/src/config/compiler.rs +++ b/src/config/compiler.rs @@ -17,8 +17,9 @@ use fs4::FileExt; fn create_data_dir_lock(data_dir: &Option) -> Result, String> { if let Some(data_dir) = data_dir { let lock_path = data_dir.join(".lock"); - let lock = File::create(&lock_path) - .map_err(|e| format!("Couldn't create lockfile for the data directory at {lock_path:?}. Error: {e}"))?; + let lock = File::create(&lock_path).map_err(|e| { + format!("Couldn't create lockfile for the data directory at {lock_path:?}. Error: {e}") + })?; match lock.try_lock_exclusive() { Ok(()) => Ok(Some(lock)), Err(e) => Err(format!("Couldn't lock {lock_path:?}. Error: {e}")),