Skip to content

Commit

Permalink
fix: 🚑 fail to create task_logs folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-labs committed Sep 9, 2024
1 parent 90b1524 commit 0e4ba66
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Binary file added .github/icon-logo-h64.ai
Binary file not shown.
7 changes: 4 additions & 3 deletions src/kurv/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ pub fn create_log_file_handles(
task_name: &str,
path: &Path,
) -> Result<((PathBuf, File), (PathBuf, File))> {
// create path if it doesn't exist
create_dir_all(path)?;

let (stdout_path, stderr_path) = get_log_paths(task_name, path);
let stdout_handle = create_or_append_file(&stdout_path)?;
let stderr_handle = create_or_append_file(&stderr_path)?;
Expand All @@ -31,6 +28,10 @@ pub fn create_log_file_handles(

/// creates a file or opens it for appending if it already exists
fn create_or_append_file(path: &Path) -> Result<File> {
if let Some(parent) = path.parent() {
create_dir_all(parent).map_err(|err| anyhow!("failed to create directories: {}", err))?;
}

OpenOptions::new()
.create(true)
.append(true)
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ use {
fn main() -> Result<()> {
Logger::init(Level::Trace)?;



match dispatch_command()? {
DispatchResult::Dispatched => Ok(()),
DispatchResult::Server => {
Expand Down
4 changes: 4 additions & 0 deletions 🧺 kurv.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"PATH": "${workspaceFolder}/target/debug;${env:PATH}",
"KURV_SERVER": "true",
"KURV_HOME": "${workspaceFolder}"
},
"lucodear-icons.files.associations": {
"*.task_logs/stdout": "log",
"*.task_logs/stderr": "log",
}
}
}

0 comments on commit 0e4ba66

Please sign in to comment.