Skip to content

Commit 18cc881

Browse files
authored
simplify run_interactive, pipeline can now accept an IOBuffer (#197)
1 parent 0832190 commit 18cc881

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

src/DockerRunner.jl

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,7 @@ function run_interactive(dr::DockerRunner, cmd::Cmd; stdin = nothing, stdout = n
212212

213213
try
214214
mount_shards(dr; verbose=verbose)
215-
if stdout isa IOBuffer
216-
if !(stdin isa IOBuffer)
217-
stdin = devnull
218-
end
219-
process = open(docker_cmd, "r", stdin)
220-
@async begin
221-
while !eof(process)
222-
write(stdout, read(process))
223-
end
224-
end
225-
wait(process)
226-
return success(process)
227-
else
228-
return success(run(docker_cmd))
229-
end
215+
return success(run(docker_cmd))
230216
finally
231217
unmount_shards(dr; verbose=verbose)
232218
# Cleanup permissions, if we need to.

src/UserNSRunner.jl

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function UserNSRunner(workspace_root::String;
6262
sandbox_cmd = `$sandbox_cmd --verbose`
6363
end
6464
sandbox_cmd = `$sandbox_cmd --rootfs $(mpath)`
65-
if cwd != nothing
65+
if cwd !== nothing
6666
sandbox_cmd = `$sandbox_cmd --cd $cwd`
6767
end
6868

@@ -204,21 +204,7 @@ function run_interactive(ur::UserNSRunner, user_cmd::Cmd; stdin = nothing, stdou
204204

205205
try
206206
mount_shards(ur; verbose=verbose)
207-
if stdout isa IOBuffer
208-
if !(stdin isa IOBuffer)
209-
stdin = devnull
210-
end
211-
process = open(cmd, "r", stdin)
212-
@async begin
213-
while !eof(process)
214-
write(stdout, read(process))
215-
end
216-
end
217-
wait(process)
218-
return success(process)
219-
else
220-
return success(run(cmd))
221-
end
207+
return success(run(cmd))
222208
finally
223209
unmount_shards(ur)
224210
end

0 commit comments

Comments
 (0)