We actually already have most of this code:

  InterruptTimer timer = new InterruptTimer("FS.readPipe");
  try {
    TimeoutInputStream in = new TimeoutInputStream(p.getInputStream(), timer);
    in.setTimeout(10000);
    BufferedReader lineRead = new BufferedReader(in, encoding));
    ...
  } finally {
    timer.terminate();
  }

If a timeout triggers, lineRead.readLine() will throw InterruptedIOException.