diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java index e6299b355a..c15eaa7a4f 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java @@ -221,9 +221,11 @@ private void stopRemoteClipboardCommands() throws Exception { } finally { if (remoteClipboardProcess != null) { try { - remoteClipboardProcess.waitFor(1, TimeUnit.SECONDS); + remoteClipboardProcess.destroy(); + assertTrue(remoteClipboardProcess.waitFor(10, TimeUnit.SECONDS)); } finally { remoteClipboardProcess.destroyForcibly(); + assertTrue(remoteClipboardProcess.waitFor(10, TimeUnit.SECONDS)); remoteClipboardProcess = null; } } diff --git a/tests/org.eclipse.swt.tests/data/clipboard/ClipboardCommandsImpl.java b/tests/org.eclipse.swt.tests/data/clipboard/ClipboardCommandsImpl.java index 3ada14d862..28123f10fa 100644 --- a/tests/org.eclipse.swt.tests/data/clipboard/ClipboardCommandsImpl.java +++ b/tests/org.eclipse.swt.tests/data/clipboard/ClipboardCommandsImpl.java @@ -43,6 +43,18 @@ public void stop() throws RemoteException { clipboardTest.log("stop()"); clipboardTest.dispose(); }); + // Force the test program to quit, but after a short delay so that + // the return value of stop can make it back to the caller and + // the JUnit test may destroy the process before this sleep + // expires anyway + SwingUtilities.invokeLater(() -> { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Thread.interrupted(); + } + System.exit(0); + }); } @Override