Skip to content

Commit

Permalink
added error for create file
Browse files Browse the repository at this point in the history
Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>
  • Loading branch information
JeevaRamanathan committed May 7, 2024
1 parent d9b9bb3 commit a6e66ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kclvm/runtime/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{fs, io::ErrorKind};
use crate::*;
use glob::glob;
use std::path::Path;
use std::io::Write;

#[no_mangle]
#[runtime_fn]
Expand Down Expand Up @@ -288,8 +289,8 @@ pub extern "C" fn kclvm_file_write(
panic!("Failed to write to '{}': {}", path, e);
}
return ValueRef::none().into_raw(ctx);
} else {
panic!("Failed to create file '{}'", path);
} else if let Err(e) = fs::File::create(&path) {
panic!("Failed to create file '{}': {}", path, e);
}
} else {
panic!("write() missing 'content' argument");
Expand Down

0 comments on commit a6e66ad

Please sign in to comment.