Type: New Feature
Priority: Minor - P4
Affects Version/s: None
Fix Version/s: None
When mongoimport reads from stdin, SIGINT (^C) terminates without flushing any outstanding data in the write buffer. So the user must do one of these to gracefully shut down and flush the buffer:
- Indicate an EOF (^D) to the terminal
- Manually close the pipe / file descriptor that's associated with stdin
- Use a command structure that automatically closes the pipe (e.g. cat out.json | mongoimport ...)
If mongoimport is run in the background as a daemon, the user doesn't have many good ways to manually flush the buffer from a scripting standpoint.
We can consider trapping SIGUSR1 to flush the buffer before passing control to the SIGINT logic. We can also potentially flush when we see SIGINT, but that might require a bit of investigation on whether that'll affect UX.