RazorDocs Search
API Reference

Cli

Type

ExportDiagnostic

Source

Describes one CDN export validation problem with a stable code and actionable context.

Remarks

Diagnostics are immutable value objects suitable for command-line output, logs, and structured inspection through ExportValidationException.Diagnostics. The public contract exposes the stable code, plain-text message, and route context. Internal exporter code may attach the discovered reference that produced the diagnostic for de-duplication and richer validation decisions.

Property

Code

string Code { get; } Source

Gets the short machine-readable diagnostic identifier.

Property

Message

string Message { get; } Source

Gets the human-readable plain-text validation message.

Property

Route

string Route { get; } Source

Gets the root-relative route or export context where the diagnostic was produced.

Property

Reference

ExportReference? Reference { get; } Source

Gets the optional exporter-managed reference that produced the diagnostic.

Remarks

This value is internal because it is tied to crawl provenance rather than the public validation exception contract. It is null for diagnostics that describe route-level failures instead of a specific markup or CSS reference.

Type

RazorWireCliApp

Source

Provides the RazorWire CLI entry surface with the command-first console behavior required for public tool flows.

Method

RunAsync

Task RunAsync(string[] args, Action<ConsoleOptions>? configureOptions = null) Source

Runs the RazorWire CLI directly through the command service while still allowing targeted startup customization.

Parameters

  • argsCommand-line arguments supplied to the CLI.
  • configureOptionsOptional console startup customization applied after RazorWire's defaults.

Returns

A task that completes when the CLI command finishes running.

Remarks

Public command-line tool entry points need predictable command output for help, validation errors, and export progress. Running the command service directly keeps those flows independent from the Generic Host lifecycle while preserving AppSurface's command registration, dependency injection, and unknown-option suggestions.

Type

ExportValidationException

Source

Represents exporter-domain validation failures that prevent CDN-safe output from being produced.

Remarks

The export engine throws this exception without depending on CLI infrastructure. Command handlers should translate it into the appropriate command-line failure type for their host.

Property

Diagnostics

IReadOnlyList<ExportDiagnostic> Diagnostics { get; } Source

Gets the diagnostics that describe why CDN export validation failed.

Type

ProcessResult

Source

Structured command execution result used by the export resolver pipeline.

Parameters

  • ExitCodeThe process exit code, or a synthetic negative value when process start failed before an operating-system exit code was available.
  • StdoutThe captured standard output for the command.
  • StderrThe captured standard error or a synthetic start-failure message.

Remarks

The resolver prefers this explicit result shape over exceptions for ordinary command failures so it can preserve stdout/stderr in logs and decide whether to throw, fall back to XML parsing, or continue probing.

Type

ExportSourceResolver

Source

Resolves export sources and, when needed, orchestrates launching a target application for crawling.

Method

ExecuteProcessAsync

Task<ProcessResult> ExecuteProcessAsync(string fileName, IReadOnlyList<string> args, string workingDirectory, CancellationToken cancellationToken) Source

Executes a command through the configured ICommandExecutor.

Parameters

  • fileNameThe executable to start.
  • argsThe ordered command-line arguments for the executable.
  • workingDirectoryThe working directory used for process start.
  • cancellationTokenCancels the command execution.

Returns

A ProcessResult containing the exit code and captured output streams from the delegated executor.

Remarks

This seam exists so resolver tests can verify command composition without launching real processes. Callers should treat a non-zero exit as data and decide whether to raise an exception or fall back.

Method

TryResolveAssemblyNameAsync

Task<string> TryResolveAssemblyNameAsync(string projectPath, string fallbackName, string? framework, CancellationToken cancellationToken) Source

Resolves the effective assembly name for a project, preferring MSBuild evaluation and falling back to raw project XML parsing when needed.

Parameters

  • projectPathThe project file whose assembly name should be resolved.
  • fallbackNameThe fallback assembly name when no explicit value can be determined.
  • frameworkThe target framework used for MSBuild evaluation. Supplying this keeps conditional AssemblyName values aligned with the publish target.
  • cancellationTokenCancels MSBuild evaluation.

Returns

The assembly name reported by MSBuild when available; otherwise the value returned by TryResolveAssemblyNameFromXml.

Exceptions

  • OperationCanceledExceptionThrown when command execution is canceled.

Remarks

MSBuild is preferred because it evaluates imports and conditional properties that raw XML parsing cannot see. If MSBuild exits non-zero, produces no usable stdout, or throws a non-cancellation exception, the resolver logs the failure details and falls back to XML parsing. Omitting framework can mis-evaluate conditional AssemblyName declarations for multi-target projects.

Method

TryResolveAssemblyNameFromXml

string TryResolveAssemblyNameFromXml(string projectPath, string fallbackName) Source

Reads a project file directly and returns the first explicit AssemblyName value found in the XML.

Parameters

  • projectPathThe project file to inspect.
  • fallbackNameThe value returned when the XML cannot be read or has no assembly name.

Returns

The explicit AssemblyName from the project file, or fallbackName when no usable value is available.

Remarks

This method intentionally does not evaluate imports or conditional MSBuild properties. It is the low-cost fallback used when MSBuild evaluation is unavailable or fails to return a usable value.

Property

ListeningUrlTimeout

TimeSpan ListeningUrlTimeout { get; set; } Source

Gets or sets the maximum time to wait for the launched target app to emit a listening URL.

Property

AppReadyTimeout

TimeSpan AppReadyTimeout { get; set; } Source

Gets or sets the maximum time to wait for the launched target app to respond as ready.

Property

AppReadyPollInterval

TimeSpan AppReadyPollInterval { get; set; } Source

Gets or sets the polling interval used while probing target app readiness.

Type

ExportSourceRequestFactory

Source

Creates validated export source requests from CLI options.

Enum

ExportMode

Source

Selects how RazorWire export output should resolve internal application URLs.

Remarks

The default selection is Cdn. Choose Cdn for output that will be served directly by a static host or CDN. Choose Hybrid only when the exported files will still be hosted behind infrastructure that preserves application routing and dynamic server behavior. New values must only be appended so existing serialized or logged enum values remain stable.

Enum

ExportReferenceKind

Source

Identifies the HTML or CSS surface where an export reference was found.

Type

ProcessLaunchSpec

Source

Describes how to launch an external process.

Property

FileName

string FileName { get; init; } Source

Gets the executable file name.

Property

Arguments

IReadOnlyList<string> Arguments { get; init; } Source

Gets the argument tokens passed to the process.

Property

EnvironmentOverrides

IReadOnlyDictionary<string, string> EnvironmentOverrides { get; init; } Source

Gets environment variable overrides applied for process startup.

Property

WorkingDirectory

string WorkingDirectory { get; init; } Source

Gets the working directory for the process.

Type

ExportCommand

Source

A command for exporting a RazorWire site to a static directory.

Method

ExecuteAsync

2 overloads
ValueTask ExecuteAsync(IConsole console) Source

Executes the export process for the RazorWire site to the configured output directory, validating options and writing progress to the console.

Parameters

  • consoleThe console used to write progress and completion messages.

Returns

A ValueTask that completes when the export operation finishes.

ValueTask ExecuteAsync(IConsole console, CancellationToken cancellationToken) Source

Executes the export process using an explicit cancellation token.

Parameters

  • consoleThe console used to write progress and completion messages.
  • cancellationTokenCancellation token for startup and export operations.

Returns

A ValueTask that completes when the export operation finishes.

Property

OutputPath

string OutputPath { get; init; } Source

Gets or sets the path to the directory where the exported site will be written. Defaults to "dist".

Property

SeedRoutesPath

string? SeedRoutesPath { get; init; } Source

Gets or sets an optional path to a plain-text file containing one initial seed route per line.

Remarks

This property is bound from the -r|--seeds command option. When it is null or empty, the exporter starts from the root route (/). When it points to a file, the exporter reads each line, accepts root-relative routes and absolute HTTP(S) URLs, strips query strings and fragments during normalization, and skips invalid, external, hash-only, JavaScript, or mailto entries. If the file is missing or unreadable, export fails and returns a non-zero CLI exit code. If the file is readable but contains no valid routes, the exporter logs a warning and falls back to the root route.

Property

Mode

ExportMode Mode { get; init; } Source

Gets or sets the export mode that controls whether output is rewritten for static CDN hosting.

Remarks

ExportMode.Cdn is the default and emits fully static output for plain static hosts. Use ExportMode.Hybrid when the exported directory will still be served behind application-style routing that can resolve extensionless URLs.

Property

BaseUrl

string? BaseUrl { get; init; } Source

Gets or sets the base URL of a running application to crawl.

Property

ProjectPath

string? ProjectPath { get; init; } Source

Gets or sets a path to a .csproj file to run and export.

Property

DllPath

string? DllPath { get; init; } Source

Gets or sets a path to a .dll file to run and export.

Property

Framework

string? Framework { get; init; } Source

Gets or sets an optional target framework for project exports, required for multi-target projects.

Property

AppArgs

string[] AppArgs { get; init; } Source

Gets or sets app arguments forwarded to the launched target app. Repeat this option for each token.

Property

NoBuild

bool NoBuild { get; init; } Source

Gets or sets a value indicating whether project mode should skip build before launch.

Type

ExportContext

Source

Provides context and state for an export operation, including configuration and crawl progress.

Property

OutputPath

string OutputPath { get; } Source

Gets the path where exported files will be saved.

Property

SeedRoutesPath

string? SeedRoutesPath { get; } Source

Gets the optional path to a seed routes file.

Property

BaseUrl

string BaseUrl { get; } Source

Gets the base URL of the source application being exported.

Property

Mode

ExportMode Mode { get; } Source

Gets the export mode that controls URL rewriting and validation behavior.

Remarks

ExportMode.Cdn is the default and rewrites exporter-managed internal URLs to emitted artifacts while validating that those managed dependencies can be served by a static host. ExportMode.Hybrid preserves application-style internal URLs for server-backed deployments that still provide routing and dynamic behavior. CDN validation and rewriting only apply to exporter-managed URLs discovered in markup and CSS; unmanaged external, JavaScript, mailto, hash-only, and data URLs are intentionally ignored rather than validated or rewritten.

Property

Visited

HashSet<string> Visited { get; } Source

Gets the set of URLs that have already been visited during the crawl.

Property

Queue

Queue<string> Queue { get; } Source

Gets the queue of URLs pending processing.

Property

Enqueued

HashSet<string> Enqueued { get; } Source

Gets the normalized routes that have already been scheduled for crawl processing.

Remarks

This set mirrors Queue membership over the lifetime of an export so duplicate reference discovery can perform O(1) scheduling checks without scanning the pending queue. Routes remain in this set after dequeue because Visited and RouteOutcomes record their terminal crawl state.

Property

RouteOutcomes

Dictionary<string, ExportRouteOutcome> RouteOutcomes { get; } Source

Gets route fetch outcomes keyed by normalized root-relative route.

Property

References

List<ExportReference> References { get; } Source

Gets every managed internal reference discovered during the crawl, including duplicate provenance.

Property

Diagnostics

List<ExportDiagnostic> Diagnostics { get; } Source

Gets CDN validation diagnostics produced for this export.

Property

ArtifactUrls

Dictionary<string, string> ArtifactUrls { get; } Source

Gets static-host artifact URLs keyed by normalized route.

Property

PartialArtifactUrls

Dictionary<string, string> PartialArtifactUrls { get; } Source

Gets generated RazorDocs partial artifact URLs keyed by their source full-page route.

Type

ITargetAppProcess

Source

Represents a started or startable external target application process.

Method

Start

void Start() Source

Starts the process and begins asynchronous output capture.

Method

DisposeAsync

ValueTask DisposeAsync() Source

Performs best-effort asynchronous cleanup of the started target process.

Returns

A task that completes after cleanup work finishes.

Remarks

Cleanup order is:
  1. Check HasExited against the underlying process when startup completed.
  2. If the process is still running, issue a best-effort Kill(entireProcessTree: true) and then wait up to 5 seconds for exit, even when kill throws a recoverable cleanup exception.
  3. After exit is observed, call WaitForExit() to flush redirected stdout and stderr callbacks before returning.
Pitfalls:
  • Short-lived processes can exit before their output callbacks are delivered, so disposal performs the final flush step to improve callback delivery timing.
  • Cleanup swallows InvalidOperationException, timeout-driven OperationCanceledException, ObjectDisposedException, and recoverable kill, wait, or flush exceptions such as Win32Exception or NotSupportedException as part of best-effort disposal.
  • Callers must not rely on guaranteed process termination; disposal can return after the 5-second timeout even if the operating system process has not fully exited.
Property

HasExited

bool HasExited { get; } Source

Gets a value indicating whether the process has exited.

Type

ITargetAppProcessFactory

Source

Creates ITargetAppProcess instances for launch specifications.

Method

Create

ITargetAppProcess Create(ProcessLaunchSpec spec) Source

Creates a new process wrapper for the provided launch spec.

Parameters

  • specThe process launch specification.

Returns

A process wrapper ready to start.

Type

TargetAppProcessFactory

Source

Default ITargetAppProcessFactory implementation.

Type

TargetAppProcessHooks

Source

Optional process-operation overrides for TargetAppProcess tests.

Remarks

These hooks exist so tests can force cleanup branches such as unsupported kill operations, synthetic exit states, or timeout handling without reflection or fragile platform-dependent child processes.

Property

StartOverride

Action<TargetAppProcess>? StartOverride { get; init; } Source

Gets or sets an optional start override used in place of Process.Start() and output-reader setup.

Remarks

Tests can use this to deterministically raise ITargetAppProcess.Exited and ITargetAppProcess.OutputLineReceived in a controlled order without depending on operating-system process timing.

Property

HasExitedOverride

Func<Process, bool>? HasExitedOverride { get; init; } Source

Gets or sets an optional exit-state override used in place of Process.HasExited.

Property

KillProcessOverride

Action<Process>? KillProcessOverride { get; init; } Source

Gets or sets an optional kill override used in place of Process.Kill(bool).

Property

WaitForExitAsyncOverride

Func<Process, CancellationToken, Task>? WaitForExitAsyncOverride { get; init; } Source

Gets or sets an optional asynchronous wait override used in place of Process.WaitForExitAsync(CancellationToken).

Property

WaitForExitOverride

Action<Process>? WaitForExitOverride { get; init; } Source

Gets or sets an optional synchronous wait override used in place of Process.WaitForExit().

Type

ExportEngine

Source

A static generation engine that crawls a RazorWire application and exports its routes to CDN or hybrid static files.

Method

RunAsync

Task RunAsync(ExportContext context, CancellationToken cancellationToken = default) Source

Crawls the site starting from configured seed routes (or the root), stages the conventional reserved 404 page when available, validates CDN output when requested, and exports discovered pages, frame sources, and assets to the output path.

Parameters

  • contextExport configuration and runtime state including base URL, output path, queue, and visited set.
  • cancellationTokenToken to observe for cooperative cancellation of the crawl and export operations.

Returns

A task that completes when the crawl and export operations have finished.

Exceptions

  • FileNotFoundExceptionThrown when ExportContext.SeedRoutesPath is specified but the file does not exist.

Remarks

If ExportContext.SeedRoutesPath is provided, the file is read and each line is validated and normalized to a root-relative route; invalid seeds are logged. If the seed file exists but yields no valid routes, the root path ("/") is enqueued. If no seed file is provided, the root path is enqueued. Before crawl processing begins, the engine probes AppSurface's reserved conventional 404 route and stages 404.html when the route returns a successful HTML response. That reserved-route probe is best-effort only: failures are logged, do not abort the crawl, and do not prevent queued seed routes from being processed. Once staged, the 404.html body participates in the same CDN validation and reference rewriting as other HTML artifacts. Export then runs as a three-stage pipeline:
seed queue -> crawl/fetch/discover -> CDN validation -> materialize/rewrite
The crawl stage records route outcomes, artifact URLs, and reference provenance. In CDN mode, HTML and CSS bodies are kept once until materialization so managed URLs can be rewritten after the artifact map is complete. In hybrid mode, text artifacts and binary assets are written directly to their final files and only their outcomes are retained in memory.
Method

CrawlRouteAsync

Task CrawlRouteAsync(HttpClient client, string route, ExportContext context, CancellationToken cancellationToken) Source

Fetches the HTML or asset for the specified route, records export graph metadata, and enqueues discovered managed references.

Method

IsDocsExportPage

bool IsDocsExportPage(string route, string html, string? docContentFrame = null) Source

Determines whether an exported HTML page should receive RazorDocs static partial support.

Parameters

  • routeThe root-relative route being exported.
  • htmlThe fetched HTML document.
  • docContentFrameThe extracted doc-content frame, when the caller has already parsed it.

Returns

true for the legacy /docs route family or HTML that carries RazorDocs runtime markers; otherwise false.

Remarks

Custom RazorDocs hosts can mount under route families such as /foo/bar, so export detection cannot rely only on path prefixes. The client config marker covers search and shell pages, while the content frame covers document detail pages.

Method

MapRouteToFilePath

string MapRouteToFilePath(string route, string outputPath, bool isHtml) Source

Maps a root-relative route to an absolute file path inside the configured output directory.

Method

ExtractFrames

void ExtractFrames(string html, ExportContext context, string currentRoute = "/") Source

Extracts root-relative `src` values from <turbo-frame> elements in the provided HTML and enqueues each unvisited path for export.

Parameters

  • htmlHTML content to scan.
  • contextThe export context.
  • currentRouteThe route used to resolve relative frame source URLs and record source provenance.
Method

ExtractAssets

void ExtractAssets(string html, string currentRoute, ExportContext context) Source

Extracts root-relative asset references (scripts, styles, images) from the provided HTML and enqueues each unvisited path for export.

Parameters

  • htmlHTML content to scan.
  • currentRouteThe route of the page being scanned, used for resolving relative URLs.
  • contextThe export context.
Method

ExtractReferences

IReadOnlyList<ExportReference> ExtractReferences(string content, string currentRoute, bool htmlScope) Source

Extracts exporter-managed internal references from HTML or CSS content.

Parameters

  • contentThe HTML document, style block, style attribute, or stylesheet body to scan.
  • currentRouteThe normalized route that owns content, used to resolve relative URLs and record provenance.
  • htmlScopetrue scans HTML surfaces including anchors, Turbo Frames, scripts, supported link tags, image sources, srcset candidates, style blocks, and style attributes. Anchors marked with data-rw-export-ignore, and relative anchors pointing at common source or project file extensions, are skipped so authoring-only source-navigation links can remain clickable without becoming CDN dependencies. false scans only CSS url(...) references.

Returns

References with managed root-relative paths only. External URLs, protocol-relative URLs, hash-only references, data URLs, JavaScript URLs, mailto links, and malformed values are filtered out before the caller enqueues or validates them.

Method

ResolveRelativeUrl

string ResolveRelativeUrl(string baseRoute, string url) Source

Resolves a potentially relative URL against a base route.

Type

ProgramEntryPoint

Source

Provides a testable wrapper around the RazorWire CLI top-level entrypoint.

Method

RunAsync

Task RunAsync(string[] args, Action<ConsoleOptions>? configureOptions = null) Source

Runs the RazorWire CLI using the same command-first startup path as the shipped program entrypoint.

Parameters

  • argsCommand-line arguments supplied to the CLI.
  • configureOptionsOptional console startup customization applied before the CLI host starts.

Returns

A task that completes when CLI execution finishes.

Method

PushConfigureOptionsOverrideForTests

IDisposable PushConfigureOptionsOverrideForTests(Action<ConsoleOptions> configureOptions) Source

Temporarily injects additional console startup configuration for the duration of a test that invokes the real assembly entrypoint.

Parameters

  • configureOptionsTest-only console startup customization applied after any explicit caller configuration.

Returns

A disposable scope that restores the previous override when disposed.

Type

ExportRouteOutcome

Source

Records the fetch and materialization state for one normalized export route.

Method

Success

2 overloads
ExportRouteOutcome Success(string route, string? contentType, string artifactPath, string artifactUrl, string? textBody) Source

Creates a successful route outcome with emitted artifact details.

Parameters

  • routeNormalized root-relative route that was crawled, such as / or /docs/start.
  • contentTypeResponse media type when known, or null when the server omitted it.
  • artifactPathAbsolute output file path written for the route.
  • artifactUrlStatic-host URL that resolves to the emitted artifact.
  • textBodyCaptured HTML or CSS body retained for later validation and rewriting, or null for streamed assets.

Returns

An outcome with Succeeded set to true, artifact fields populated, and no status code or exception.

ExportRouteOutcome Success(string route, string? contentType, string artifactPath, string artifactUrl) Source

Creates a successful route outcome for an artifact whose body does not need deferred validation or rewriting.

Parameters

  • routeNormalized root-relative route that was crawled, such as / or /docs/start.
  • contentTypeResponse media type when known, or null when the server omitted it.
  • artifactPathAbsolute output file path written for the route.
  • artifactUrlStatic-host URL that resolves to the emitted artifact.

Returns

An outcome with Succeeded set to true, artifact fields populated, and no retained body.

Method

NonSuccess

ExportRouteOutcome NonSuccess(string route, HttpStatusCode statusCode) Source

Creates an outcome for a route that completed at the HTTP layer with a non-success status code.

Parameters

  • routeNormalized root-relative route that was crawled.
  • statusCodeHTTP status code returned by the source application.

Returns

An outcome with Succeeded set to false, StatusCode populated, and no artifact or exception fields.

Exceptions

  • ArgumentExceptionThrown when route is null, empty, or whitespace.
  • ArgumentOutOfRangeExceptionThrown when statusCode is a successful 2xx HTTP status code.
Method

Failed

ExportRouteOutcome Failed(string route, Exception exception) Source

Creates an outcome for a route that failed because an exception interrupted fetch or write processing.

Parameters

  • routeNormalized root-relative route that was being processed.
  • exceptionException that prevented the route from completing.

Returns

An outcome with Succeeded set to false, Exception populated, and no status or artifact fields.

Property

Route

string Route { get; } Source

Gets the normalized root-relative route that was fetched.

Property

Succeeded

bool Succeeded { get; } Source

Gets a value indicating whether the route fetched successfully.

Property

ContentType

string? ContentType { get; } Source

Gets the response media type when one was available, optionally including media-type parameters.

Property

StatusCode

HttpStatusCode? StatusCode { get; } Source

Gets the non-success response status code when the fetch failed at the HTTP layer.

Property

ArtifactPath

string? ArtifactPath { get; } Source

Gets the absolute output file path for a successful route.

Property

ArtifactUrl

string? ArtifactUrl { get; } Source

Gets the static-host URL that should be used to reach the emitted artifact.

Property

TextBody

string? TextBody { get; } Source

Gets the fetched HTML or CSS body retained until materialization.

Property

Exception

Exception? Exception { get; } Source

Gets the exception that prevented the route from being fetched or written.

Property

IsHtml

bool IsHtml { get; } Source

Gets a value indicating whether the route was fetched as HTML.

Property

IsCss

bool IsCss { get; } Source

Gets a value indicating whether the route was fetched as CSS.

Type

RazorWireCliModule

Source

A terminal/CLI module for RazorWire providing static site export capabilities.

Method

ConfigureServices

void ConfigureServices(StartupContext context, IServiceCollection services) Source

Configures services needed for the CLI, including the export pipeline and command-owned logging defaults.

Parameters

  • contextThe startup context.
  • servicesThe service collection to populate.
Method

ConfigureHostBeforeServices

void ConfigureHostBeforeServices(StartupContext context, IHostBuilder builder) Source

Executes pre-service host configuration; currently no implementation is required.

Parameters

  • contextThe startup context.
  • builderThe host builder.
Method

ConfigureHostAfterServices

void ConfigureHostAfterServices(StartupContext context, IHostBuilder builder) Source

Executes post-service host configuration; currently no implementation is required.

Parameters

  • contextThe startup context.
  • builderThe host builder.
Method

RegisterDependentModules

void RegisterDependentModules(ModuleDependencyBuilder builder) Source

Registers dependencies for this module; currently no implementation is required.

Parameters

  • builderThe module dependency builder.
Type

ExportReference

Source

Describes one exporter-managed internal URL discovered while crawling HTML or CSS.

Remarks

RawValue is the exact value found in markup or CSS. ResolvedUrl is the root-relative URL after resolving relative references against SourceRoute. Path is the query-free route used for fetch de-duplication, while Query and Fragment preserve the original URL shape for CDN validation and rewriting decisions.

Property

IsAsset

bool IsAsset { get; } Source

Gets a value indicating whether the reference points at an asset-like dependency rather than a page route.

Type

CommandExecutor

Source

Default ICommandExecutor implementation backed by Process.

Remarks

This implementation models launch failures as ProcessResult instances instead of throwing so resolver code can treat command execution as data and decide whether to fall back or raise a richer exception. If the command is canceled after launch starts, cancellation is propagated and the finally block still attempts to stop the child process tree.

Method

ExecuteCommandAsync

Task<ProcessResult> ExecuteCommandAsync(string fileName, IReadOnlyList<string> args, string workingDirectory, CancellationToken cancellationToken) Source

Starts a child process, captures its output streams, and returns the resulting ProcessResult.

Parameters

  • fileNameThe executable to launch.
  • argsThe ordered command-line arguments passed to the executable.
  • workingDirectoryThe working directory supplied to the process start info.
  • cancellationTokenCancels the process wait and output reads.

Returns

A ProcessResult whose fields contain the exit code, stdout, and stderr on success, or a synthetic failure result when the process cannot be started.

Exceptions

  • OperationCanceledExceptionThrown when cancellation is observed after launch begins.

Remarks

The method intentionally returns ProcessResult for launch/setup failures so callers can preserve command context in their own diagnostics. The finally block always attempts Kill(entireProcessTree: true) for started processes, so callers should assume cancellation or mid-flight failures may terminate child processes spawned by the launched command.

Type

ICommandExecutor

Source

Executes child processes for the export pipeline while preserving a structured ProcessResult contract for callers.

Remarks

This abstraction exists so resolver logic can verify command composition without launching real processes in tests. Callers should prefer it whenever they need stdout, stderr, exit code, and cancellation behavior surfaced in a consistent shape.

Method

ExecuteCommandAsync

Task<ProcessResult> ExecuteCommandAsync(string fileName, IReadOnlyList<string> args, string workingDirectory, CancellationToken cancellationToken) Source

Executes a command and captures its exit code, standard output, and standard error.

Parameters

  • fileNameThe executable to start.
  • argsThe ordered command-line arguments passed to fileName.
  • workingDirectoryThe working directory used for process start.
  • cancellationTokenCancels the launched process and any in-flight output reads.

Returns

A ProcessResult whose ExitCode, Stdout, and Stderr describe the completed command or a start-up failure.

Remarks

Implementations should avoid throwing for ordinary process start failures so higher-level callers can decide whether to surface an exception, retry, or fall back. Cancellation should still propagate via OperationCanceledException.