From 0694fddd25857c52c23a9eb412c338783ee03d5a Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Fri, 16 Apr 2021 21:22:14 -0400 Subject: [PATCH] Allow the `with_executor` function to take keyword arguments, which it will forward to the `executor_type` constructor --- src/Sandbox.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Sandbox.jl b/src/Sandbox.jl index 06d24f2..5d03b89 100644 --- a/src/Sandbox.jl +++ b/src/Sandbox.jl @@ -121,8 +121,12 @@ for f in (:run, :success) end end -function with_executor(f::Function, executor_type::Type{<:SandboxExecutor} = preferred_executor()) - exe = executor_type() +""" + with_executor(f::Function, ::Type{<:SandboxExecutor} = preferred_executor(); kwargs...) +""" +function with_executor(f::F, ::Type{T} = preferred_executor(); + kwargs...) where {F <: Function, T <: SandboxExecutor} + exe = T(; kwargs...) try return f(exe) finally