-
Notifications
You must be signed in to change notification settings - Fork 7
/
solver.jl
30 lines (24 loc) · 804 Bytes
/
solver.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
struct Solver
path::String
source::String
args::String
function Solver(path::String, source::String, args::String)
if !isabspath(path)
@warn "Solver path is not absolute. Make sure $path is on your PATH."
end
return new(path, source, args)
end
end
Solver(path::String, source::String; args::String="") = Solver(path, source, args)
function run(solver::Solver, folder::String)
binary = solver.path
source = solver.source
args = solver.args
out = basename(binary) * "UncertaintyQuantification.out"
err = basename(binary) * "UncertaintyQuantification.err"
p = pipeline(
!isempty(args) ? `$binary $args $source` : `$binary $source`; stdout=out, stderr=err
)
cd(() -> run(p), folder)
return nothing
end