fix(interpreter): use correct binary name for argv[0]
This commit is contained in:
@@ -54,13 +54,12 @@ impl Computer {
|
||||
|
||||
fn init_stack(&mut self) -> Result<(), InterpreterError> {
|
||||
let mut args = Args::parse();
|
||||
// cant panic, as we would not be here without a valid binary path...
|
||||
let path = &args.path.unwrap();
|
||||
|
||||
// set executable name as argv[0]
|
||||
let path = &args.path.unwrap();
|
||||
let filename = Path::new(path).file_name().unwrap().to_str().unwrap();
|
||||
|
||||
let mut argv = Vec::from([path.clone()]);
|
||||
// add the rest of the arguements argv[1], ...
|
||||
let mut argv = Vec::from([filename.to_string()]);
|
||||
argv.append(&mut args.argv);
|
||||
|
||||
// set default env
|
||||
|
||||
Reference in New Issue
Block a user