protected String runScriptTaskAndGetOutput(GhidraScript script) throws Exception {
		SpyConsole spyConsole = installSpyConsole();

		Task task = new RunScriptTask(script, plugin.getCurrentState(), spyConsole);
		task.addTaskListener(provider.getTaskListener());

		CountDownLatch latch = new CountDownLatch(1);
		task.addTaskListener(new TaskListener() {

			@Override
			public void taskCompleted(Task t) {
				latch.countDown();
			}

			@Override
			public void taskCancelled(Task t) {
				latch.countDown();
			}
		});

		TaskLauncher.launch(task);

		latch.await(TASK_RUN_SCRIPT_TIMEOUT_SECS, TimeUnit.SECONDS);

		String output = spyConsole.getApiOutput();
		spyConsole.clear();
		return output;
	}
Run the last script by pressing the last script button and return output.

@param taskName name for the task listener
@return script output written to the console
@throws Exception on failure, e.g. timeout
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java