Verify that ProcessUtils#exec can be interrupted

This test requires the 'sleep' program, therefore we only test it on
Linux and MacOSX, but not on Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Give ReadInto a chance to return gently upon EOF

Earlier, we tried to make ReadInto interruptible by avoiding the
blocking readLine() call (instead calling ready() in a while loop that
slept for some time to give the Thread a chance to be interrupted).

This is a problem, though, because ready() will not return true if
the stream was closed, therefore readLine() cannot return null to
indicate EOF, and the Thread will be stuck in an infinite loop.

Instead, call readLine() directly and instead of trying to interrupt
the thread, close the input reader. That way, the loop will be
naturally interrupted upon EOF.

To keep the Thread interruptible even if readLine() blocks on a stream
that is not closed yet, close the stream in the interrupt() method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a signature to ReadInto that enables closing the output upon exit

We will need this to allow redirecting stdin in ProcessUtils via a
ReadInto instance.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a ProcessUtils#exec method that accepts an stdin stream

Some programs require input via stdin...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Refactor StderrLogService to provide an abstract LogService

This will help implement a LogService targeting, say, ImageJ 1.x.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>