Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Adapt verbose output for isolate #196

Open
wants to merge 1 commit into
base: rollback
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/Products.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down