mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
virt tools: Use Sys.file_exists instead of clumsy open_in/close_in hack.
No functional change.
Fixes commit c466d4cb92.
This commit is contained in:
@@ -193,13 +193,7 @@ module Windows = struct
|
||||
let srvany =
|
||||
try
|
||||
List.find (
|
||||
fun service ->
|
||||
try
|
||||
let chan = open_in (virt_tools_data_dir // service) in
|
||||
close_in chan;
|
||||
true
|
||||
with _ ->
|
||||
false
|
||||
fun service -> Sys.file_exists (virt_tools_data_dir // service)
|
||||
) services
|
||||
with Not_found ->
|
||||
error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)")
|
||||
|
||||
@@ -48,14 +48,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
|
||||
let installer =
|
||||
try
|
||||
let t, tool = List.find (
|
||||
fun (_, tool) ->
|
||||
try (
|
||||
let exe_path = virt_tools_data_dir // tool in
|
||||
let chan = open_in exe_path in
|
||||
close_in chan;
|
||||
true
|
||||
) with _ ->
|
||||
false
|
||||
fun (_, tool) -> Sys.file_exists (virt_tools_data_dir // tool)
|
||||
) tools in
|
||||
Some (t, virt_tools_data_dir // tool)
|
||||
with Not_found -> (
|
||||
|
||||
Reference in New Issue
Block a user