fixed permissions issue in load-with

This commit is contained in:
Ava Apples Affine 2023-03-30 20:02:45 -07:00
parent e8cf59b7a7
commit dcbc855783
Signed by: affine
GPG key ID: 3A4645B8CF806069
3 changed files with 46 additions and 16 deletions

View file

@ -1,14 +1,36 @@
[package]
name = "relish"
version = "0.1.0"
authors = ["Ava <ava@sunnypup.io>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dirs = "3.0"
nu-ansi-term = "0.47.0"
reedline = "0.17.0"
nix = "0.26.2"
ctrlc = { version = "3.0", features = ["termination"] }
Readme.org:65:Function calls are executed as soon as the tree is evaluated. See the following example:
Readme.org:324:You can use it by calling it in your shell config (See file:snippets/basic_minimal_configuration.rls for more info).
Readme.org:382:See file:snippets/basic_minimal_configuration.rls for an example of a basic minimal configuration file.
snippets/userlib.rls:13:;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/userlib.rls:45: See the userlib tests for an easy to follow example of this.'
snippets/userlib-tests.rls:13:;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/eval_draft2.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/eval.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/bin/main.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/func.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/segment.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/control.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/stl.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/str.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/config.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/lib.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/lex.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/append.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/initial_rough_spaghetti_implementation/vars.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/seperate_tables/func.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
snippets/legacy/seperate_tables/vars.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/eval.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/bin/main.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/run.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/segment.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/sym.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/posix.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/decl.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/strings.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/control.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/math.rs:10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/boolean.rs:10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/stl/append.rs:10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/lib.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
src/lex.rs:11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

View file

@ -495,6 +495,7 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
- pwd
- Documentation!
- Do I need some linemode management stuff?
- Fake load in pre-posix shell outputs "shell not yet configured!"
- Escape sequences in strings
- logging library
- make const all the error messages

View file

@ -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