protected PtyTerminalSession runInTerminal(List<String> commandLine, Map<String, String> env,
			File workingDirectory, Collection<TerminalSession> subordinates) throws IOException {
		PtyFactory factory = getPtyFactory();
		Pty pty = factory.openpty();

		PtyParent parent = pty.getParent();
		PtyChild child = pty.getChild();
		Terminal terminal = terminalService.createWithStreams(plugin, Charset.forName("UTF-8"),
			parent.getInputStream(), parent.getOutputStream());

		List<String> withoutPath = ShellUtils.removePath(commandLine);
		terminal.setSubTitle(ShellUtils.generateLine(withoutPath));
		TerminalListener resizeListener = new TerminalListener() {
			@Override
			public void resized(short cols, short rows) {
				try {
					child.setWindowSize(cols, rows);
				}
				catch (Exception e) {
					Msg.error(this, "Could not resize pty: " + e);
				}
			}
		};
		terminal.addTerminalListener(resizeListener);

		env.put("TERM", "xterm-256color");
		PtySession session =
			pty.getChild().session(commandLine.toArray(String[]::new), env, workingDirectory);

		Thread waiter = new Thread(() -> {
			try {
				session.waitExited();
				terminal.terminated();
				pty.close();

				for (TerminalSession ss : subordinates) {
					ss.terminate();
				}
			}
			catch (InterruptedException | IOException e) {
				Msg.error(this, e);
			}
		}, "Waiter: " + getConfigName());
		waiter.start();

		PtyTerminalSession terminalSession =
			new PtyTerminalSession(terminal, pty, session, waiter);
		terminal.setTerminateAction(() -> {
			tool.execute(new TerminateSessionTask(terminalSession));
		});
		return terminalSession;
	}
Obtain the launcher arguments

<p>
This should either call {@link #promptLauncherArgs(LaunchConfigurator, Throwable)} or
{@link #loadLastLauncherArgs(boolean)}. Note if choosing the latter, the user will not be
prompted to confirm.

@param prompt true to prompt the user, false to use saved arguments
@param configurator the rules for configuring the launcher
@param lastExc if retrying, the last exception to display as an error message
@return the chosen arguments, or null if the user cancels at the prompt
Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java