Replace call to sudo with mocks

This replaces the actual calls to `console` and `process` with some stubs, so that this could also run on Travis CI. wdyt?