I think this may be useful, at least for testing purposes, a do-block that turns on the network, and puts it back to the original setting when it finishes.
function with_network(f::Function; ctx::Ptr{Proj.PJ_CONTEXT} = C_NULL)
as_before = Proj.network_enabled(ctx)
Proj.enable_network!(true, ctx)
try
f()
finally
Proj.enable_network!(as_before, ctx)
end
end
Proj.enable_network!()
Proj.enable_network!(false)
Proj.network_enabled()
with_network() do
@show Proj.network_enabled()
end
I think this may be useful, at least for testing purposes, a do-block that turns on the network, and puts it back to the original setting when it finishes.