@@ -24,7 +24,9 @@ namespace Synapse.Runner.Services.Executors;
2424/// <param name="context">The current <see cref="ITaskExecutionContext"/></param>
2525/// <param name="schemaHandlerProvider">The service used to provide <see cref="ISchemaHandler"/> implementations</param>
2626/// <param name="serializer">The service used to serialize/deserialize objects to/from JSON</param>
27- public class ContainerProcessExecutor ( IServiceProvider serviceProvider , ILogger < ContainerProcessExecutor > logger , ITaskExecutionContextFactory executionContextFactory , ITaskExecutorFactory executorFactory , IContainerPlatform containers , ITaskExecutionContext < RunTaskDefinition > context , ISchemaHandlerProvider schemaHandlerProvider , IJsonSerializer serializer )
27+ /// <param name="options">The service used to access the current <see cref="RunnerOptions"/></param>
28+ public class ContainerProcessExecutor ( IServiceProvider serviceProvider , ILogger < ContainerProcessExecutor > logger , ITaskExecutionContextFactory executionContextFactory , ITaskExecutorFactory executorFactory ,
29+ IContainerPlatform containers , ITaskExecutionContext < RunTaskDefinition > context , ISchemaHandlerProvider schemaHandlerProvider , IJsonSerializer serializer , IOptions < RunnerOptions > options )
2830 : TaskExecutor < RunTaskDefinition > ( serviceProvider , logger , executionContextFactory , executorFactory , context , schemaHandlerProvider , serializer )
2931{
3032
@@ -38,6 +40,11 @@ public class ContainerProcessExecutor(IServiceProvider serviceProvider, ILogger<
3840 /// </summary>
3941 protected ContainerProcessDefinition ProcessDefinition => this . Task . Definition . Run . Container ! ;
4042
43+ /// <summary>
44+ /// Gets the current <see cref="RunnerOptions"/>
45+ /// </summary>
46+ protected RunnerOptions Options { get ; } = options . Value ;
47+
4148 /// <summary>
4249 /// Gets the <see cref="IContainer"/> to run
4350 /// </summary>
@@ -57,6 +64,7 @@ protected override async Task DoExecuteAsync(CancellationToken cancellationToken
5764 await this . Container ! . StartAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
5865 await this . Container . WaitForExitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
5966 var standardOutput = ( this . Container . StandardOutput == null ? null : await this . Container . StandardOutput . ReadToEndAsync ( cancellationToken ) . ConfigureAwait ( false ) ) ? . Trim ( ) ;
67+ if ( this . Options . Containers . Platform == ContainerPlatform . Docker ) standardOutput = standardOutput ? [ 8 ..] ;
6068 var standardError = ( this . Container . StandardError == null ? null : await this . Container . StandardError . ReadToEndAsync ( cancellationToken ) . ConfigureAwait ( false ) ) ? . Trim ( ) ;
6169 var result = standardOutput ; //todo: do something with return data encoding (ex: plain-text, json);
6270 await this . SetResultAsync ( result , this . Task . Definition . Then , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments