@@ -24,7 +24,9 @@ namespace Synapse.Runner.Services.Executors;
24
24
/// <param name="context">The current <see cref="ITaskExecutionContext"/></param>
25
25
/// <param name="schemaHandlerProvider">The service used to provide <see cref="ISchemaHandler"/> implementations</param>
26
26
/// <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 )
28
30
: TaskExecutor < RunTaskDefinition > ( serviceProvider , logger , executionContextFactory , executorFactory , context , schemaHandlerProvider , serializer )
29
31
{
30
32
@@ -38,6 +40,11 @@ public class ContainerProcessExecutor(IServiceProvider serviceProvider, ILogger<
38
40
/// </summary>
39
41
protected ContainerProcessDefinition ProcessDefinition => this . Task . Definition . Run . Container ! ;
40
42
43
+ /// <summary>
44
+ /// Gets the current <see cref="RunnerOptions"/>
45
+ /// </summary>
46
+ protected RunnerOptions Options { get ; } = options . Value ;
47
+
41
48
/// <summary>
42
49
/// Gets the <see cref="IContainer"/> to run
43
50
/// </summary>
@@ -57,6 +64,7 @@ protected override async Task DoExecuteAsync(CancellationToken cancellationToken
57
64
await this . Container ! . StartAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
58
65
await this . Container . WaitForExitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
59
66
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 ..] ;
60
68
var standardError = ( this . Container . StandardError == null ? null : await this . Container . StandardError . ReadToEndAsync ( cancellationToken ) . ConfigureAwait ( false ) ) ? . Trim ( ) ;
61
69
var result = standardOutput ; //todo: do something with return data encoding (ex: plain-text, json);
62
70
await this . SetResultAsync ( result , this . Task . Definition . Then , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments