fixed permissions issue in load-with
This commit is contained in:
parent
e8cf59b7a7
commit
dcbc855783
3 changed files with 46 additions and 16 deletions
|
|
@ -26,6 +26,7 @@ use std::fs::File;
|
|||
use std::process::{Command, Child, Stdio};
|
||||
use nix::unistd;
|
||||
use ctrlc;
|
||||
use std::fs::OpenOptions;
|
||||
|
||||
pub struct ShellState {
|
||||
pub parent_pid: unistd::Pid,
|
||||
|
|
@ -201,7 +202,10 @@ fn load_with_callback(ast: &Seg, syms: &mut SymTable, state: &mut ShellState) ->
|
|||
return false
|
||||
}
|
||||
|
||||
let out = File::open(filename).or(File::create(filename));
|
||||
let out = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(filename);
|
||||
if !out.is_ok() {
|
||||
e = Some(out.unwrap_err().to_string());
|
||||
return false
|
||||
|
|
@ -215,7 +219,10 @@ fn load_with_callback(ast: &Seg, syms: &mut SymTable, state: &mut ShellState) ->
|
|||
return false
|
||||
}
|
||||
|
||||
let err = File::open(filename).or(File::create(filename));
|
||||
let err = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(filename);
|
||||
if !err.is_ok() {
|
||||
e = Some(err.unwrap_err().to_string());
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue