OCaml: use the new behaviour of Std_utils.which

Since Std_utils.which can handle relative/absolute paths, remove the
manual checks, and use Std_utils.which directly.
This commit is contained in:
Pino Toscano
2019-01-11 17:00:11 +01:00
parent ebe2c7b458
commit d3ff88c894
2 changed files with 2 additions and 14 deletions

View File

@@ -408,9 +408,7 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args =
fd
in
try
let app =
if Filename.is_relative app then which app
else (Unix.access app [Unix.X_OK]; app) in
let app = which app in
let outfd = get_fd Unix.stdout stdout_fd in
let errfd = get_fd Unix.stderr stderr_fd in
if echo_cmd then

View File

@@ -251,17 +251,7 @@ read the man page virt-dib(1).
if elements = [] then
error (f_"at least one distribution root element must be specified");
let python =
match python with
| Some exe ->
let p =
if String.find exe Filename.dir_sep <> -1 then (
Unix.access exe [Unix.X_OK];
exe
) else
get_required_tool exe in
Some p
| None -> None in
let python = Option.map get_required_tool python in
{ debug = debug; basepath = basepath; elements = elements;
excluded_elements = excluded_elements; element_paths = element_paths;