@Override
	public void runScript(String scriptName, String[] scriptArguments, GhidraState scriptState)
			throws Exception {

		boolean isHeadlessScript = false;

		if (scriptSetOption != null) {
			resolveContinuationOptionWith(scriptSetOption);
			scriptSetOption = null;
		}
		ResourceFile scriptSource = GhidraScriptUtil.findScriptByName(scriptName);
		if (scriptSource != null) {
			GhidraScriptProvider provider = GhidraScriptUtil.getProvider(scriptSource);

			if (provider == null) {
				throw new IOException("Attempting to run subscript '" + scriptName +
					"': unable to run this script type.");
			}

			GhidraScript script = provider.getScriptInstance(scriptSource, errorWriter);
			isHeadlessScript = script instanceof HeadlessScript ? true : false;

			if (potentialPropertiesFileLocs.size() > 0) {
				script.setPotentialPropertiesFileLocations(potentialPropertiesFileLocs);
			}

			if (scriptState == state) {
				updateStateFromVariables();
			}

			if (isHeadlessScript) {
				((HeadlessScript) script).setHeadlessInstance(headless);
				((HeadlessScript) script).setRunningInnerScript(true);
			}

			script.setScriptArgs(scriptArguments);

			script.execute(scriptState, getControls());

			if (scriptState == state) {
				loadVariablesFromState();
			}

			// Resolve continuations options, if they have changed
			if (isHeadlessScript) {
				HeadlessContinuationOption innerScriptOpt =
					((HeadlessScript) script).getHeadlessContinuationOption();

				if (innerScriptOpt != null) {
					resolveContinuationOptionWith(innerScriptOpt);
				}

				((HeadlessScript) script).setRunningInnerScript(false);
			}

			return;
		}

		throw new IllegalArgumentException("Script does not exist: " + scriptName);
	}
Returns whether analysis for the current program has timed out.
<p>
Analysis will time out only in the case where:
<ol>
		<li>the users has set an analysis timeout period using the <code>-analysisTimeoutPerFile</code>
	parameter</li>
		<li>analysis is enabled and has completed</li>
		<li>the current script is being run as a postScript (since postScripts run after
analysis)</li>
</ol>

@return whether analysis timeout occurred
@throws ImproperUseException if not in headless mode or headless instance not set
Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessScript.java