Skip to content

Commit

Permalink
Allow the with_executor function to take keyword arguments, which i…
Browse files Browse the repository at this point in the history
…t will forward to the `executor_type` constructor
  • Loading branch information
DilumAluthge authored and staticfloat committed Apr 22, 2021
1 parent 39998ce commit 0694fdd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Sandbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0694fdd

Please sign in to comment.