Skip to content

Commit

Permalink
create_new() is only available from 1.77; use older way (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuommaki authored Aug 11, 2024
1 parent de622b2 commit e071f58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ pub fn run(callback: impl Fn(Task) -> Result<TaskResult>) -> Result<()> {
let task: Task = serde_json::from_reader(file)?;

let result = callback(task).map_err(|e| e.to_string());
let mut result_file =
File::create_new(PathBuf::from(WORKSPACE_PATH).join(TASK_RESULT_FILE_NAME))?;
let mut result_file = File::options()
.read(true)
.write(true)
.create_new(true)
.open(PathBuf::from(WORKSPACE_PATH).join(TASK_RESULT_FILE_NAME))?;
serde_json::to_writer(&mut result_file, &result)?;
result_file.flush()?;
drop(result_file);
Expand Down

0 comments on commit e071f58

Please sign in to comment.