mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2025-01-12 22:42:33 +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 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))
|
isdir(dirname(solverlog)) || mkpath(dirname(solverlog))
|
||||||
|
|
||||||
log = open(solverlog, "a+")
|
status, (λ, P, ws) = open(solverlog, "a+") do logfile
|
||||||
λ, P, warmstart = redirect_stdout(f, log)
|
Base.Libc.flush_cstdio()
|
||||||
close(log)
|
redirect_stdout(logfile) do
|
||||||
|
PropertyT.solve(model, varλ, varP, warmstart)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return status, (λ, P, warmstart)
|
return status, (λ, P, warmstart)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user