mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 18:25:30 +01:00
fix redirection of scs log via do-block
This commit is contained in:
parent
6b90197ae3
commit
e0a141dd5d
@ -196,18 +196,14 @@ end
|
||||
|
||||
function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
|
||||
|
||||
function f()
|
||||
Base.Libc.flush_cstdio()
|
||||
status, (λ, P, ws) = PropertyT.solve(model, varλ, varP, warmstart)
|
||||
Base.Libc.flush_cstdio()
|
||||
return λ, P, ws
|
||||
end
|
||||
|
||||
isdir(dirname(solverlog)) || mkpath(dirname(solverlog))
|
||||
|
||||
log = open(solverlog, "a+")
|
||||
λ, P, warmstart = redirect_stdout(f, log)
|
||||
close(log)
|
||||
status, (λ, P, ws) = open(solverlog, "a+") do logfile
|
||||
Base.Libc.flush_cstdio()
|
||||
redirect_stdout(logfile) do
|
||||
PropertyT.solve(model, varλ, varP, warmstart)
|
||||
end
|
||||
end
|
||||
|
||||
return status, (λ, P, warmstart)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user