public CommandProcessorResponse processLine(String line, boolean allowInterrupting) throws CommandProcessorException {
    SignalHandler oldSignal = null;
    Signal interruptSignal = null;

    if (allowInterrupting) {
      // Remember all threads that were running at the time we started line processing.
      // Hook up the custom Ctrl+C handler while processing this line
      interruptSignal = new Signal("INT");
      oldSignal = Signal.handle(interruptSignal, new SignalHandler() {
        private boolean interruptRequested;

        @Override
        public void handle(Signal signal) {
          boolean initialRequest = !interruptRequested;
          interruptRequested = true;

          // Kill the VM on second ctrl+c
          if (!initialRequest) {
            console.printInfo("Exiting the JVM");
            System.exit(127);
          }

          // Interrupt the CLI thread to stop the current statement and return
          // to prompt
          console.printInfo("Interrupting... Be patient, this might take some time.");
          console.printInfo("Press Ctrl+C again to kill JVM");

          // First, kill any running MR jobs
          HadoopJobExecHelper.killRunningJobs();
          TezJobExecHelper.killRunningJobs();
          HiveInterruptUtils.interrupt();
        }
      });
    }

    try {
      CommandProcessorResponse lastRet = new CommandProcessorResponse();
      CommandProcessorResponse ret;

      // we can not use "split" function directly as ";" may be quoted
      List<String> commands = splitSemiColon(line);

      StringBuilder command = new StringBuilder();
      for (String oneCmd : commands) {

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

        try {
          ret = processCmd(command.toString());
          lastRet = ret;
        } catch (CommandProcessorException e) {
          boolean ignoreErrors = HiveConf.getBoolVar(conf, HiveConf.ConfVars.CLI_IGNORE_ERRORS);
          if (!ignoreErrors) {
            throw e;
          }
        } finally {
          command.setLength(0);
        }
      }
      return lastRet;
    } finally {
      // Once we are done processing the line, restore the old handler
      if (oldSignal != null && interruptSignal != null) {
        Signal.handle(interruptSignal, oldSignal);
      }
    }
  }
Processes a line of semicolon separated commands

@param line
         The commands to process
@param allowInterrupting
         When true the function will handle SIG_INT (Ctrl+C) by interrupting the processing and
         returning -1
@return 0 if ok
cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java