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 shouldPrintOnlyFailedStatementFromScriptFile() throws Exception {
    // Given:
    final File scriptFile = TMP.newFile("script.sql");
    Files.write(scriptFile.toPath(), (""
        + "drop stream if exists s1;\n"
        + "create stream if not exist s1(id int) with (kafka_topic='s1', value_format='json', "
        + "partitions=1);\n").getBytes(StandardCharsets.UTF_8));

    // When:
    final int error_code = localCli.runScript(scriptFile.getPath());

    // Then:
    final String out = terminal.getOutputString();
    final String expected = "line 2:22: Syntax Error\n" +
        "Syntax error at or near 'exist' at line 2:22\n" +
        "Statement: create stream if not exist s1(id int) with " +
        "(kafka_topic='s1', value_format='json', partitions=1);\n" +
        "Caused by: line 2:22: Syntax error at line 2:22\n";
    assertThat(error_code, is(-1));
    assertThat(out, is(expected));
    assertThat(out, not(containsString("drop stream if exists")));
  }