Cancel reading from stdin on Ctrl-C
Created by: mrnugget
This is essentially a copy-paste implementation of the ideas presented in this comment here: https://github.com/golang/go/issues/20280#issuecomment-655588450
It fixes #775 (closed) and helps with the issue described in https://github.com/sourcegraph/src-cli/pull/793#issuecomment-1163310725. Not sure if it has unintended side-effects.
Test plan
- Manually tested only the
src batch preview -f -
case, not the other cases.