Put process output streams into a separate thread for logging

Fixes #5