コード例 #1
0
        /// <inheritdoc />
        public override Task <string[]> ScanAsync(string path, CancellationToken cancellationToken)
        {
            var exitCode = _processRunner.RunTillCompletion(BackendPath, GetBackendArguments(path), cancellationToken,
                                                            out var standardOutput, out var standardError);

            if (ThrowOnNonZeroExitCode && exitCode != 0)
            {
                throw new ApplicationException($"Process has terminated with an exit code {exitCode}");
            }

            return(Task.FromResult(MatchRegex
                                   .Matches(ParseStdErr ? standardError : standardOutput)
                                   .Where(x => x.Success)
                                   .Select(x => x.Groups["threat"].Value)
                                   .ToArray()));
        }