Skip to content

Commit 8c5b51e

Browse files
authored
Merge pull request #1033 from Vlatombe/revert-getLogFile
2 parents f70e44e + 999856e commit 8c5b51e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/KubernetesPipelineTest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import static org.junit.Assert.assertTrue;
4242
import static org.junit.Assume.*;
4343

44-
import java.io.File;
4544
import java.util.Arrays;
4645
import java.util.Collections;
4746
import 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);

0 commit comments

Comments
 (0)