From fef13d63d96ebc44f87b926c9544a85df9ae7b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 31 May 2020 16:02:49 +0200 Subject: [PATCH] Adapt verbose output for isolate --- src/Products.jl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Products.jl b/src/Products.jl index 4bc51e5..f58e117 100644 --- a/src/Products.jl +++ b/src/Products.jl @@ -166,7 +166,8 @@ function locate(lp::LibraryProduct; verbose::Bool = false, if isolate # Isolated dlopen is a lot slower, but safer dl_esc_path = replace(dl_path, "\\"=>"\\\\") - if success(`$(Base.julia_cmd()) --startup-file=no -e "import Libdl; Libdl.dlopen(\"$(dl_esc_path)\")"`) + isolate_command = `$(Base.julia_cmd()) --startup-file=no -e "import Libdl; Libdl.dlopen(\"$(dl_esc_path)\")"` + if success(isolate_command) return dl_path end else @@ -178,10 +179,16 @@ function locate(lp::LibraryProduct; verbose::Bool = false, end if verbose - try - dlopen(dl_path) - catch dlopen_result - @info("$(dl_path) cannot be dlopen'ed",dlopen_result) + if isolate + err = Base.PipeEndpoint() + Base._spawn(isolate_command, Any[devnull, devnull, err]) + @info("$(dl_path) cannot be dlopen'ed in an isolated julia session:\n$isolate_command\n$(read(err, String))") + else + try + dlopen(dl_path) + catch dlopen_result + @info("$(dl_path) cannot be dlopen'ed",dlopen_result) + end end end else