OCaml: Handle some edge cases; refactor parser, main.ml; add config fetcher
This commit is contained in:
parent
6096817932
commit
cb56da1462
16 changed files with 229 additions and 105 deletions
|
|
@ -17,22 +17,3 @@ let format (command : command) : string =
|
|||
|
||||
let format_many (commands : command list) : string list =
|
||||
List.map format commands
|
||||
|
||||
let check_su_command (schema: schema): schema =
|
||||
let command = schema.input.configuration.main.su_command in
|
||||
let path = Reader.read [||] ("which " ^ command) in
|
||||
try Unix.access path.output [Unix.X_OK]; schema
|
||||
with Unix.Unix_error _ -> elog "";
|
||||
{
|
||||
schema with
|
||||
output =
|
||||
{
|
||||
schema.output with
|
||||
main =
|
||||
"Super user command " ^ command ^
|
||||
" not executable at path '" ^ path.output ^
|
||||
"' (exit status " ^ path.status ^ ", stderr: '" ^
|
||||
path.error ^ "')\n"
|
||||
};
|
||||
meta = { schema.meta with status = 1 };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue