mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user