@Override
		public void run() {
			String line = null;
			try {
				while (!isDisposed && (line = shellOutput.readLine()) != null) {
					if (line.contains("Address already in use")) {
						throw new IllegalStateException("Server already running--could not start!");
					}
					if (line.contains("ERROR")) {
						terminateIn(1000);
					}
					if (line.contains("Registering Ghidra Server...")) {
						synchronized (this) {
							serverStartComplete = true;
							notifyAll();
						}
					}
					Msg.info(this, "SERVER " + line);
				}
			}
			catch (Exception e) {
				if (!isDisposed) { // don't care about exceptions happening as a result of disposing
					ConcurrentTestExceptionHandler.handle(this, e);
				}
			}
			finally {
				synchronized (this) {
					terminated = true;
					notifyAll();
				}
			}
		}
Thread to read from an input stream and write it to stdout.
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/server/remote/ServerTestUtil.java