Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-640

Graceful handling of Ctrl-C

    • Type: Icon: Story Story
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.13.1
    • Affects Version/s: None
    • Component/s: None
    • 5
    • Iteration Athens, Iteration Barcelona, Iteration Chicago
    • Needed
    • Hide

      The CTRL-C behavior changes compared to the old shell:

      • Hitting CTRL-C will not kill the shell (directly, only when hit multiple times)
      • CTRL-C will stop execution of code and also terminate any operations that are running on the server

      Known cases where CTRL-C *WILL NOT* terminate operations on the server reliably:

      • On MongoDB Server v4.0.x (only works on v4.1.x and above)
      • When the user code contains explicit asynchronous code - like the use of setTimeout, setImmediate, or things like fs.readFile (which were not available in the old shell). The behavior there is the same as with the default Node.js REPL - as it is not possible to kill async code execution.
      Show
      The CTRL-C behavior changes compared to the old shell: Hitting CTRL-C will not kill the shell (directly, only when hit multiple times) CTRL-C will stop execution of code and also terminate any operations that are running on the server Known cases where CTRL-C * WILL NOT * terminate operations on the server reliably: On MongoDB Server v4.0.x (only works on v4.1.x and above) When the user code contains explicit asynchronous code - like the use of setTimeout, setImmediate, or things like fs.readFile (which were not available in the old shell). The behavior there is the same as with the default Node.js REPL - as it is not possible to kill async code execution.

      User Story

      As a user,
      I want to be able to gracefully interrupt running commands,
      So that I can quickly stop a command that I typed wrong and get back to the prompt to try again

      Acceptance Criteria

      • Ctrl-C gracefully interrupts the active command
      • When the command is interrupted, the shell will attempt to cleanly terminate the operation on the server and print a warning if that is not possible
      • After the command is interrupted, the user gets back to the prompt and can run the next command
      • Ctrl-C does not terminate the shell

            Assignee:
            michael.rose@mongodb.com Michael Rose (Inactive)
            Reporter:
            massimiliano.marcon@mongodb.com Massimiliano Marcon
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: