Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-2634

Cli exit current cmd.exe instead of the start-cli.bat script file

    XMLWordPrintableJSON

Details

    Description

      The EXIT command was added to start-cli.bat in IOTDB-2523 to make sure the script exit/return with the correct Exit Code. However, the EXIT terminates current cmd.exe instead of just exiting the .bat script file. They are the same while using CLI by double-click on the .bat file, as the activated cmd.exe is temporal and will always be terminated by OS when the script exits. But when we pre-activate a cmd.exe window and call the start-cli.bat by file name/path, the EXIT will close the window and prevent subsequent user commands. (By the way, Windows PowerShell is not affected.) Things are similar when we call the start-cli.bat with CALL clause from another .bat script and no commands after CALL will be executed.

      One of the most affected thing is the register-UDF.bat for UDF-Library, which is using multiple CALL start-cli.bat commands to register all UDF functions. Now the script will exit once after the first CALL is executed, and the following functions will not be registered at all.

      The way to fix this is adding the parameter /B for EXIT command(EXIT /B %ret_code%), which makes the EXIT only affect the current .bat script and return to the caller script or cmd.exe window.

      Attachments

        Issue Links

          Activity

            People

              ericpai Eric Pai
              DomingSias Dongming Zhao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: