Skip to content

Commit bb2c34a

Browse files
committed
Set headless flag earlier in test initialization
1 parent 4c399be commit bb2c34a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/org/labkey/test/Runner.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494

9595
public class Runner extends TestSuite
9696
{
97+
static
98+
{
99+
// Prevent `java.awt.HeadlessException` on Windows on TeamCity
100+
String headless = "java.awt.headless";
101+
if (System.getProperty(headless) == null)
102+
System.setProperty(headless, "false");
103+
}
104+
97105
private static final Logger LOG = LogManager.getLogger(Runner.class);
98106

99107
private static final int DEFAULT_MAX_TEST_FAILURES = 10;
@@ -220,7 +228,6 @@ private static void saveTestDuration(Test currentWebTest, long durationMs)
220228
@Override
221229
public synchronized void runTest(final Test test, final TestResult testResult)
222230
{
223-
System.setProperty("java.awt.headless", "false"); // Prevent `java.awt.HeadlessException` on Windows on TeamCity
224231
long startTimeMs = System.currentTimeMillis();
225232
if (_cleanOnly)
226233
{

0 commit comments

Comments
 (0)