function hook_process_output(channel, callback) {
      var old_write = process[channel].write;
      process[channel].write = (function(write) {
          return function(string, encoding, fd) {
              write.apply(process[channel], arguments)
              callback(string, encoding, fd)
          }
      })(process[channel].write)

      // Return a function that can be used to undo this change
      return function() {
        process[channel].write = old_write
      };
    }
We synchronously send all errors to the backend main process.

This is important because errors can frequently happen right
before a renderer window is closing. Since error reporting hits
APIs and is asynchronous it's possible for the window to be
destroyed before the report makes it.

This is a rare use of `sendSync` to ensure the command has made
it before the window closes.