private static int processLine(String line) {
    int ret = 0;

    String command = "";
    for (String oneCmd : line.split(";")) {

      if (StringUtils.endsWith(oneCmd, "\\")) {
        command += StringUtils.chop(oneCmd) + ";";
        continue;
      } else {
        command += oneCmd;
      }
      if (StringUtils.isBlank(command)) {
        continue;
      }

      ret = processCmd(command);
      command = "";
    }
    return ret;
  }
Wrapper for System.exit that makes sure we close our SessionState
before we exit. This ignores any error generated by attempting to
close the session state, merely printing out the error. The return
code is not changed in such an occurrence because we want to retain
the success code of whatever command we already ran.
hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/HCatCli.java