File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 4141import static org .junit .Assert .assertTrue ;
4242import static org .junit .Assume .*;
4343
44- import java .io .File ;
4544import java .util .Arrays ;
4645import java .util .Collections ;
4746import java .util .List ;
@@ -154,14 +153,8 @@ public void runInPod() throws Exception {
154153 new Thread (() -> {
155154 long pos = 0 ;
156155 try {
157- while (true ) {
158- Jenkins j = Jenkins .getInstanceOrNull ();
159- if (j == null ) {
160- break ;
161- }
162- // not using Computer#getLogDir as it has side-effect of creating log directories which can create a race condition with main code
163- File logFile = new File (j .getRootDir (), "logs/slaves/" + c .getName () + "/slave.log" );
164- if (logFile .isFile ()) { // TODO should LargeText.FileSession handle this?
156+ while (Jenkins .getInstanceOrNull () != null ) { // otherwise get NPE from Computer.getLogDir
157+ if (c .getLogFile ().isFile ()) { // TODO should LargeText.FileSession handle this?
165158 pos = c .getLogText ().writeLogTo (pos , System .out );
166159 }
167160 Thread .sleep (100 );
You can’t perform that action at this time.
0 commit comments