public int runScript(final String scriptFile) {
    int errorCode = NO_ERROR;
    RemoteServerSpecificCommand.validateClient(terminal.writer(), restClient);

    try {
      // RUN SCRIPT calls the `makeKsqlRequest` directly, which does not support PRINT/SELECT.
      //
      // To avoid interfere with the RUN SCRIPT behavior, this code loads the content of the
      // script and execute it with the 'handleLine', which supports PRINT/SELECT statements.
      //
      // RUN SCRIPT should be fixed to support PRINT/SELECT, but also should prevent override
      // variables and properties from the CLI session.


      final String content = Files.readAllLines(Paths.get(scriptFile), StandardCharsets.UTF_8)
          .stream().collect(Collectors.joining(System.lineSeparator()));

      handleLine(content);
    } catch (final Exception exception) {
      errorCode = ERROR;

      LOGGER.error("An error occurred while running a script file. Error = "
          + exception.getMessage(), exception);

      terminal.printError(ErrorMessageUtil.buildErrorMessage(exception),
          exception.toString());
    }

    terminal.flush();

    return errorCode;
  }
@Test
  public void shouldPrintErrorIfCantConnectToRestServerOnRunScript() throws Exception {
    // Given
    final KsqlRestClient mockRestClient = givenMockRestClient();
    when(mockRestClient.getServerInfo())
        .thenThrow(new KsqlRestClientException("Boom", new IOException("")));

    new Cli(1L, 1L, mockRestClient, console)
        .runScript("script_file_ignored");

    assertThat(terminal.getOutputString(),
        containsString("Please ensure that the URL provided is for an active KSQL server."));
  }