public void waitForScriptCompletion(ScriptTaskListener listener, long timeoutMS) {
		String scriptName = listener.getScriptName();
		long start = System.currentTimeMillis();
		Msg.debug(this, "Waiting for script " + scriptName + ": " + new Date(start));
		while (!listener.isCompleted()) {
			sleep(DEFAULT_WAIT_DELAY);
			long currentTime = System.currentTimeMillis();
			if (currentTime - start > timeoutMS) {
				Msg.error(this, "Timeout on script: " + scriptName + ": " + new Date(currentTime));
				throw new RuntimeException("Timeout waiting for task to complete");
			}
		}
		Msg.debug(this,
			"Script " + scriptName + " completed: " + new Date(System.currentTimeMillis()));
	}
Waits for a launched script to complete by using the given listener.

@param listener the listener used to track script progress
@param timeoutMS the max time to wait; failing if exceeded
Ghidra/Features/Base/src/main/java/ghidra/test/AbstractGhidraHeadlessIntegrationTest.java