StartProcess Class
Starts a system process.
graph BT Type-->Base0["ParallelSyncMultiConfigModule"] click Base0 "/api/Statiq.Common/ParallelSyncMultiConfigModule" Base0-->Base1["ParallelMultiConfigModule"] click Base1 "/api/Statiq.Common/ParallelMultiConfigModule" Base1-->Base2["MultiConfigModuleBase"] click Base2 "/api/Statiq.Common/MultiConfigModuleBase" Base2-->Base3["Module"] click Base3 "/api/Statiq.Common/Module" Base3-->Base4["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type-.->Interface1["IParallelModule"] click Interface1 "/api/Statiq.Common/IParallelModule" Type-.->Interface2["IDisposable"] Type["StartProcess"] class Type type-node

Syntax

public class StartProcess : ParallelSyncMultiConfigModule, IModule, IParallelModule, IDisposable

Remarks

This module can start both foreground and background processes. If the process is a foreground process (the default), the module will wait for it to return and output a document with the process standard output as it's content. If the process is a background process, the module will fork it and let it run, but no output document will be generated and it will log with a debug level.

Constructors

Name Summary
StartProcess(Config<string>, Config<string>) Starts a process for the specified file name and arguments.
StartProcess(Config<string>) Starts a process for the specified file name and arguments.

Fields

Name Field Type Constant Value Summary
ErrorData string ErrorData
A metadata key that contains any error data from the process.
static
ExitCode string ExitCode
A metadata key that contains the process exit code.
static

Properties

Name Property Type Summary
Configs IReadOnlyDictionary<string, IConfig>
Inherited from MultiConfigModuleBase
ForceDocumentExecution bool
Inherited from MultiConfigModuleBase
Parallel bool
Indicates whether documents will be processed by this module in parallel.

Methods

Name Return Value Summary
AfterExecution(IExecutionContext, ExecutionOutputs) void
Called after each module execution.
Inherited from Module
AfterExecutionAsync(IExecutionContext, ExecutionOutputs) Task
Called after each module execution.
Inherited from Module
AsBackground(bool, bool) StartProcess
Starts the process and leaves it running in the background.
BeforeExecution(IExecutionContext) void
Called before each module execution.
Inherited from Module
BeforeExecutionAsync(IExecutionContext) Task
Called before each module execution.
Inherited from Module
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, IDocument, IExecutionContext, Task<TValue>>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, IDocument, IExecutionContext, TValue>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, IExecutionContext, Task<TValue>>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, IExecutionContext, TValue>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, Task<TValue>>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
CombineConfig<TValue>(string, Config<TValue>, Func<TValue, TValue, TValue>) MultiConfigModuleBase
Inherited from MultiConfigModuleBase
ContinueOnError(Config<bool>) StartProcess
Toggles throwing an exception if the process exits with a non-zero exit code.
Dispose() void
ExecuteAsync(IExecutionContext) Task<IEnumerable<IDocument>>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
ExecuteConfig(IDocument, IExecutionContext, IMetadata) IEnumerable<IDocument>
ExecuteConfigAsync(IDocument, IExecutionContext, IMetadata) Task<IEnumerable<IDocument>>
Executes the module for each input document. If there aren't any input documents and the config delegate doesn't require documents, this will be called once with a null input.
ExecuteContextAsync(IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module once for all input documents.
ExecuteInputAsync(IDocument, IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module.
Inherited from MultiConfigModuleBase
Finally(IExecutionContext) void
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
FinallyAsync(IExecutionContext) Task
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
GetConfig(string) IConfig
Gets the config for a given key.
Inherited from MultiConfigModuleBase
GetConfig<TValue>(string) Config<TValue>
Gets the config for a given key cast to a specific config value.
Inherited from MultiConfigModuleBase
HideArguments(Config<bool>) StartProcess
Toggles whether to hide the arguments list when logging the process command.
KeepContent(Config<bool>) StartProcess
Keeps the existing document content instead of replacing it with the process output.
LogErrors(Config<bool>) StartProcess
Toggles whether to log error process output as error messages.
LogOutput(Config<bool>) StartProcess
Toggles whether to log standard process output as information messages.
OnlyOnce(bool) StartProcess
Only starts the process on the first module execution.
SetConfig(string, IConfig) MultiConfigModuleBase
Sets the config for a given key.
Inherited from MultiConfigModuleBase
TryGetConfig(string, IConfig) bool
Inherited from MultiConfigModuleBase
WithArgument(Config<StartProcessArgument>) StartProcess
Appends an argument to the command.
WithArgument(Config<string>, bool) StartProcess
Appends an argument to the command.
WithArgument(Config<string>, Config<string>, bool) StartProcess
Appends an argument to the command.
WithArguments(Config<IReadOnlyList<StartProcessArgument>>) StartProcess
Appends arguments to the command.
WithEnvironmentVariable(Config<KeyValuePair<string, string>>) StartProcess
Sets a process-specific environment variable.
WithEnvironmentVariables(Config<IEnumerable<KeyValuePair<string, string>>>) StartProcess
Sets process-specific environment variables.
WithErrorExitCode(Func<int, bool>) StartProcess
Provides a function that determines if the exit code from the process was an error.
WithTimeout(Config<int>) StartProcess
Sets a timeout in milliseconds before the process will be terminated.
WithWorkingDirectory(Config<string>) StartProcess
Sets the working directory to use for the process relative to the root path.

Extension Methods