Coree.NETStandard
  • API
Show / Hide Table of Contents
  • Coree.NETStandard.Abstractions.DependencySingleton
    • DependencySingleton<T>
    • IDependencySingleton
  • Coree.NETStandard.Abstractions.FluentBase
    • FluentBase
    • IFluentBase <<<<<<< HEAD =======
  • Coree.NETStandard.Abstractions.ServiceFactory
    • ServiceFactory<T>
  • Coree.NETStandard.Classes.AsyncEventCollection
    • AsyncEventCollection<T>
    • AsyncEventCollection<T>.CustomEventDelegate
  • Coree.NETStandard.Classes.Criteria
    • CriteriaComparisonMethod
    • CriteriaEnumerableExtensions
    • CriteriaExpressionBuilder
    • CriteriaItem<TValue>
    • CriteriaItems
    • CriteriaOperator
    • CriteriaQueryableExtensions
  • Coree.NETStandard.Classes.Scheduler
    • Scheduler
    • Scheduler.TickerEventArgs
    • Scheduler.TickerEventDelegate
  • Coree.NETStandard.Classes.ThreadSafeCollection
    • ThreadSafeCollection<T>
  • Coree.NETStandard.Classes.ThreadSafeValue
    • ThreadSafeValue<T>
  • Coree.NETStandard.Classes.TimeOfDay
    • TimeOfDay >>>>>>> release
  • Coree.NETStandard.Abstractions.ServiceFactory
    • ServiceFactory<T>
  • <<<<<<< HEAD Coree.NETStandard.Classes.AsyncEventCollection
    • AsyncEventCollection<T>
    • AsyncEventCollection<T>.CustomEventDelegate
  • Coree.NETStandard.Classes.Criteria
    • CriteriaComparisonMethod ======= Coree.NETStandard.Extensions.Collections.Enumerable
      • CollectionsEnumerableExtensions
    • Coree.NETStandard.Extensions.Collections.List
      • CollectionsListExtensions
    • Coree.NETStandard.Extensions.Conversions.ByteArray
      • ConversionsByteArrayExtensions
    • Coree.NETStandard.Extensions.Conversions.HostApplicationBuilder
      • ConversionsHostApplicationBuilderExtensions
    • Coree.NETStandard.Extensions.Conversions.String
      • ConversionsStringExtensions
      • Encodings >>>>>>> release
    • Coree.NETStandard.Extensions.Conversions.Stringbuilder
      • <<<<<<< HEAD CriteriaEnumerableExtensions ======= ConversionsStringbuilderExtension >>>>>>> release
    • Coree.NETStandard.Extensions.Primitives.Bool
      • <<<<<<< HEAD CriteriaExpressionBuilder ======= PrimitivesBoolExtensions >>>>>>> release
    • Coree.NETStandard.Extensions.Reflection.ServiceProvider
      • <<<<<<< HEAD CriteriaItem<TValue> ======= ReflectionServiceProviderExtensions >>>>>>> release
    • Coree.NETStandard.Extensions.Threading.CancellationToken
      • <<<<<<< HEAD CriteriaItems ======= ThreadingCancellationTokenExtensions >>>>>>> release
    • Coree.NETStandard.Extensions.Utilities
      • <<<<<<< HEAD CriteriaOperator ======= DateTimeExtensions >>>>>>> release
    • Coree.NETStandard.Extensions.Validations.String
      • <<<<<<< HEAD CriteriaQueryableExtensions
    • Coree.NETStandard.Classes.HttpRequestService
      • ContentComposer
      • HttpRequestHeadersExtensions
      • HttpRequestService
      • HttpRequestServiceHandler
      • HttpRequestServiceUriExtensions
      • ServiceCollectionExtensions
      • TransactionRecord
    • Coree.NETStandard.Classes.ThreadSafeCollection
      • ThreadSafeCollection<T>
    • Coree.NETStandard.Classes.ThreadSafeValue
      • ThreadSafeValue<T>
    • Coree.NETStandard.Classes.TimeOfDay
      • TimeOfDay
    • Coree.NETStandard.Extensions.Collections.Enumerable
      • CollectionsEnumerableExtensions
    • Coree.NETStandard.Extensions.Collections.List
      • CollectionsListExtensions
    • Coree.NETStandard.Extensions.Conversions.ByteArray
      • ConversionsByteArrayExtensions
    • Coree.NETStandard.Extensions.Conversions.HostApplicationBuilder
      • ConversionsHostApplicationBuilderExtensions
    • Coree.NETStandard.Extensions.Conversions.String
      • ConversionsStringExtensions
      • Encodings
    • Coree.NETStandard.Extensions.Conversions.Stringbuilder
      • ConversionsStringbuilderExtension
    • Coree.NETStandard.Extensions.Http.HttpHeader
      • HttpHeadersExtensions
    • Coree.NETStandard.Extensions.Primitives.Bool
      • PrimitivesBoolExtensions
    • Coree.NETStandard.Extensions.Reflection.ServiceProvider
      • ReflectionServiceProviderExtensions
    • Coree.NETStandard.Extensions.Threading.CancellationToken
      • ThreadingCancellationTokenExtensions
    • Coree.NETStandard.Extensions.Utilities
      • DateTimeExtensions
    • Coree.NETStandard.Extensions.Validations.String
      • ======= >>>>>>> release ValidationsStringExtensions
    • Coree.NETStandard.HostedServicesCollection
      • HostedServicesCollectionConfig<T>
      • IHostedServicesCollectionConfig<T>
      • ServiceCollectionExtensions
      • ServiceProviderExtensions
    • Coree.NETStandard.Serilog
      • ConditionalLevelSink
      • LoggerSinkConfigurationExtensions
      • OutputTemplates
      • ServiceCollectionExtensions
      • SourceContextShortEnricher
    • Coree.NETStandard.Services.DebugService
      • <<<<<<< HEAD DebugService
      • IDebugService ======= IRuntimeInsightsx
      • RuntimeInsightsServicex >>>>>>> release
    • Coree.NETStandard.Services.FileService
      • FileService
      • IFileService
    • Coree.NETStandard.Services.Process
      • IProcessService
      • ProcessRunExitCodeState
      • ProcessRunResult
      • ProcessService
    • Coree.NETStandard.Services.RuntimeInsightsService
      • IRuntimeInsightsService
      • RuntimeInsightsService
    • Coree.NETStandard.SpectreConsole
      • CommandAppExtensions
      • HostBuilderExtensions
      • ServiceCollectionExtensions
      • SpectreConsoleHostedService
      • SpectreConsoleHostedService.ExitCode
      • SpectreConsoleTypeRegistrar
      • SpectreConsoleTypeResolver
    • Coree.NETStandard.UnderConstruction
      • DbContextExtensions
      • HttpClientStatic
      • HttpClientStatic.HttpClientResponse
      • HttpClientStatic.XRate
      • HttpClientStatic.XRateGroup
      • HttpClientStatic.XRateItem
      • IScheduleProvider
      • IntervalScheduleProvider
      • LimitedHistory<T>
      • ScheduleCombiner
      • <<<<<<< HEAD Scheduler
      • Scheduler.TickerEventArgs
      • Scheduler.TickerEventDelegate
      • ======= >>>>>>> release Scheduler2
      • Scheduler2.TickerEventArgs
      • Scheduler2.TickerEventDelegate
      • Scheduler3
      • Scheduler3.TickerEventArgs
      • Scheduler3.TickerEventDelegate
      • SqlliteMemoryContext
      • SqlliteMemoryContext.UserDataDto
      • TimedEntry<T>
      • Timing
      • Timing.Ticker
      • Timing.Ticker.TickerEventArgs
      • Timing.TickerSync
      • WeekDayAtScheduleProvider
    • Coree.NETStandard.Utilities
      • EventSubscription
      • MainContext

Class ProcessService

Defines a service for running external processes with support for cancellation and timeouts.

Inheritance
object
DependencySingleton<ProcessService>
ProcessService
Implements
IProcessService
IDependencySingleton
Inherited Members
DependencySingleton<ProcessService>.SetLogLevelFilter(LogLevel)
DependencySingleton<ProcessService>.Instance
DependencySingleton<ProcessService>.logger
DependencySingleton<ProcessService>.configuration
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Coree.NETStandard.Services.Process
Assembly: Coree.NETStandard.dll
Syntax
public class ProcessService : DependencySingleton<ProcessService>, IProcessService, IDependencySingleton

Constructors

| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

ProcessService(ILogger<ProcessService>, IConfiguration)

Initializes a new instance of the ProcessService class with the specified logger and configuration.

Declaration
public ProcessService(ILogger<ProcessService> logger, IConfiguration configuration)
Parameters
Type Name Description
ILogger<ProcessService> logger

The logger instance for logging messages.

IConfiguration configuration

The configuration instance for accessing application settings.

Methods

| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

RunProcessWithCancellationSupportAsync(string, string, string, bool, CancellationToken, TimeSpan?)

Runs an external process asynchronously with options for cancellation and timeout.

Declaration
public Task<ProcessRunResult> RunProcessWithCancellationSupportAsync(string fileName, string arguments, string workingDirectory, bool killOnCancel = false, CancellationToken cancellationWaitRequest = default, TimeSpan? timeout = null)
Parameters
Type Name Description
string fileName

The name of the executable to run.

string arguments

The arguments to pass to the executable.

string workingDirectory

The working directory for the process.

bool killOnCancel

Indicates whether the process should be killed if a cancellation is requested.

CancellationToken cancellationWaitRequest

The cancellation token that can be used to request cancellation of the operation.

TimeSpan? timeout

Optional timeout after which the process will be killed if not completed.

Returns
Type Description
Task<ProcessRunResult>

A task that represents the asynchronous operation, containing the result of the process execution.

Implements

IProcessService
IDependencySingleton
  • <<<<<<< HEAD Edit this page
  • View Source ======= Edit this page
  • View Source >>>>>>> release
In this article
Back to top