private boolean runScript(GhidraState scriptState, GhidraScript script) {
		if (script instanceof HeadlessScript) {
			((HeadlessScript) script).setHeadlessInstance(this);
		}

		ResourceFile srcFile = script.getSourceFile();
		String scriptName =
			srcFile != null ? srcFile.getAbsolutePath() : (script.getClass().getName() + ".class");

		try {
			Msg.info(this, "SCRIPT: " + scriptName);

			// Execute the script, but don't directly write to stdout or stderr. The headless
			// analyzer only uses the logging mechanism to get output to the user.
			script.execute(scriptState, ScriptControls.NONE);
		}
		catch (Exception exc) {
			String logErrorMsg = "REPORT SCRIPT ERROR: ";
			Msg.error(this, logErrorMsg, exc);
			return false;
		}

		return true;
	}
Runs the specified script with the specified state.

@param scriptState State representing environment variables that the script is able
					  to access.
@param script Script to be run.
@return  whether the script successfully completed running
Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java