@@ -262,6 +262,7 @@ impl SandboxBuilder {
262262 workspace : & Workspace ,
263263 timeout : Option < Duration > ,
264264 no_output_timeout : Option < Duration > ,
265+ process_lines : Option < & mut dyn FnMut ( & str ) > ,
265266 ) -> Result < ( ) , Error > {
266267 let container = self . create ( workspace) ?;
267268
@@ -276,7 +277,7 @@ impl SandboxBuilder {
276277 }
277278 } }
278279
279- container. run ( timeout, no_output_timeout) ?;
280+ container. run ( timeout, no_output_timeout, process_lines ) ?;
280281 Ok ( ( ) )
281282 }
282283}
@@ -323,12 +324,18 @@ impl Container<'_> {
323324 & self ,
324325 timeout : Option < Duration > ,
325326 no_output_timeout : Option < Duration > ,
327+ process_lines : Option < & mut dyn FnMut ( & str ) > ,
326328 ) -> Result < ( ) , Error > {
327- let res = Command :: new ( self . workspace , "docker" )
329+ let mut cmd = Command :: new ( self . workspace , "docker" )
328330 . args ( & [ "start" , "-a" , & self . id ] )
329331 . timeout ( timeout)
330- . no_output_timeout ( no_output_timeout)
331- . run ( ) ;
332+ . no_output_timeout ( no_output_timeout) ;
333+
334+ if let Some ( f) = process_lines {
335+ cmd = cmd. process_lines ( f) ;
336+ }
337+
338+ let res = cmd. run ( ) ;
332339 let details = self . inspect ( ) ?;
333340
334341 // Return a different error if the container was killed due to an OOM
0 commit comments