File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -605,12 +605,24 @@ def wait_for_container(self, container):
605605 try :
606606 for line in container .logs (stream = True ):
607607 self .log .info (line .decode ("utf-8" ), extra = dict (phase = "running" ))
608+
608609 finally :
609610 container .reload ()
610611 if container .status == "running" :
611612 self .log .info ("Stopping container...\n " , extra = dict (phase = "running" ))
612613 container .kill ()
613614 exit_code = container .attrs ["State" ]["ExitCode" ]
615+
616+ container .wait ()
617+
618+ self .log .info (
619+ "Container finished running.\n " .upper (), extra = dict (phase = "running" )
620+ )
621+ # are there more logs? Let's send them back too
622+ late_logs = container .logs ().decode ("utf-8" )
623+ for line in late_logs .split ("\n " ):
624+ self .log .info (line + "\n " , extra = dict (phase = "running" ))
625+
614626 container .remove ()
615627 if exit_code :
616628 sys .exit (exit_code )
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ if [[ ! -z "${R2D_ENTRYPOINT:-}" ]]; then
1515 if [[ ! -x " $R2D_ENTRYPOINT " ]]; then
1616 chmod u+x " $R2D_ENTRYPOINT "
1717 fi
18- exec " $R2D_ENTRYPOINT " " $@ " >& " $log_fd "
18+ exec " $R2D_ENTRYPOINT " " $@ " 2>&1 >& " $log_fd "
1919else
20- exec " $@ " >& " $log_fd "
20+ exec " $@ " 2>&1 >& " $log_fd "
2121fi
2222
2323# Close the logging output again
24- # exec {log_fd}>&-
24+ exec {log_fd}>& -
Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ def test_env():
4242 # value
4343 "--env" ,
4444 "SPAM_2=" ,
45- "--" ,
45+ # "--",
4646 tmpdir ,
4747 "/bin/bash" ,
4848 "-c" ,
4949 # Docker exports all passed env variables, so we can
5050 # just look at exported variables.
51- "export" ,
51+ "export; sleep 1" ,
52+ # "export; echo TIMDONE",
53+ # "export",
5254 ],
5355 universal_newlines = True ,
5456 stdout = subprocess .PIPE ,
@@ -61,6 +63,9 @@ def test_env():
6163 # stdout should be empty
6264 assert not result .stdout
6365
66+ print (result .stderr .split ("\n " ))
67+ # assert False
68+
6469 # stderr should contain lines of output
6570 declares = [x for x in result .stderr .split ("\n " ) if x .startswith ("declare" )]
6671 assert 'declare -x FOO="{}"' .format (ts ) in declares
You can’t perform that action at this time.
0 commit comments