public int Run()

in TeamCity.CSharpInteractive/ScriptRunner.cs [27:59]


    public int Run()
    {
        var summary = new Summary(true);
        try
        {
            int? exitCode = default;
            foreach (var (command, success, currentExitCode) in _commandsRunner.Run(GetCommands()))
            {
                if (success.HasValue)
                {
                    if (!success.Value)
                    {
                        summary = summary.WithSuccess(false);
                        break;
                    }
                }
                else
                {
                    _log.Error(ErrorId.NotSupported, $"{command} is not supported.");
                }

                exitCode = currentExitCode;
            }

            var actualExitCode = exitCode ?? (summary.Success == false || _statistics.Errors.Count > 0 ? 1 : 0);
            _log.Trace(() => new []{new Text($"Exit code: {actualExitCode}.")});
            return actualExitCode;
        }
        finally
        {
            _summaryPresenter.Show(summary);
        }
    }