Simon Janssen pushed to branch SimonJ at Stefan / Typer
Commits: b5b56a92 by JanssenSimon at 2022-07-11T12:07:25-04:00 Corrige arrays->list
- - - - - 0c224c20 by JanssenSimon at 2022-07-20T11:17:32-04:00 Fix les bogues avec execvp
- - - - -
2 changed files:
- btl/unix.typer - src/tunix.ml
Changes:
===================================== btl/unix.typer ===================================== @@ -6,7 +6,7 @@ File_link = Built-in "File.link" : String -> String -> IO Unit; File_symlink = Built-in "File.symlink" : String -> String -> IO Unit; File_rename = Built-in "File.rename" : String -> String -> IO Unit; Proc_fork = Built-in "Proc.fork" : Unit -> Int; -Proc_execvp = Built-in "Proc.execvp" : Array String -> IO Unit; +Proc_execvp = Built-in "Proc.execvp" : List String -> IO Unit;
File_stdin = Built-in "File.stdin" : Unit -> FileHandle;
===================================== src/tunix.ml ===================================== @@ -81,15 +81,15 @@ let rec extract_strings tlist = match tlist with | _ -> error dloc "Argument of extract_strings not a list" (* test this function ^ *) let proc_execvp loc _depth args_val = match args_val with - | [Vcons ((_, "args"), [program; args])] + | [Vcons ((_, _), [program; args])] -> (match program with | Vstring proc - -> Vcommand (fun () -> try Unix.execvp proc (Array.of_list (extract_strings args)); - with Unix.Unix_error(_, _, _) -> - error loc "Process exited with error code." - tunit) - | _ -> error loc "Problem with list of String arguments in Proc.execvp") - | _ -> error loc "Proc.execvp expects a String argument (program name) and a list of String arguments." + -> Vcommand (fun () -> try Unix.execvp proc (Array.of_list (extract_strings args)) with + | Unix.Unix_error(_, _, _) -> error loc "Process exited with error code." + | _ -> error loc "Something went terribly wrong when executing the process." + tunit) + | _ -> error loc "Proc.execvp expects a list of >String arguments<.") + | _ -> error loc "Proc.execvp expects a >list< of String arguments."
let builtin_functions = [ ("File.unlink" , file_unlink,1);
View it on GitLab: https://gitlab.com/monnier/typer/-/compare/e23a685d4b233d23b592d2cb97dddc22a...
Afficher les réponses par date