@@ -23,6 +23,7 @@ internal class RpcWorkerProcess : WorkerProcess
23
23
private readonly WorkerProcessArguments _workerProcessArguments ;
24
24
private readonly string _workerDirectory ;
25
25
private readonly IOptions < FunctionsHostingConfigOptions > _hostingConfigOptions ;
26
+ private readonly IEnvironment _environment ;
26
27
27
28
internal RpcWorkerProcess ( string runtime ,
28
29
string workerId ,
@@ -36,7 +37,8 @@ internal RpcWorkerProcess(string runtime,
36
37
IWorkerConsoleLogSource consoleLogSource ,
37
38
IMetricsLogger metricsLogger ,
38
39
IServiceProvider serviceProvider ,
39
- IOptions < FunctionsHostingConfigOptions > hostingConfigOptions )
40
+ IOptions < FunctionsHostingConfigOptions > hostingConfigOptions ,
41
+ IEnvironment environment )
40
42
: base ( eventManager , processRegistry , workerProcessLogger , consoleLogSource , metricsLogger , serviceProvider , rpcWorkerConfig . Description . UseStdErrorStreamForErrorsOnly )
41
43
{
42
44
_runtime = runtime ;
@@ -49,13 +51,15 @@ internal RpcWorkerProcess(string runtime,
49
51
_workerProcessArguments = rpcWorkerConfig . Arguments ;
50
52
_workerDirectory = rpcWorkerConfig . Description . WorkerDirectory ;
51
53
_hostingConfigOptions = hostingConfigOptions ;
54
+ _environment = environment ;
52
55
}
53
56
54
57
internal override Process CreateWorkerProcess ( )
55
58
{
56
59
var workerContext = new RpcWorkerContext ( Guid . NewGuid ( ) . ToString ( ) , RpcWorkerConstants . DefaultMaxMessageLengthBytes , _workerId , _workerProcessArguments , _scriptRootPath , _serverUri ) ;
57
60
workerContext . EnvironmentVariables . Add ( WorkerConstants . FunctionsWorkerDirectorySettingName , _workerDirectory ) ;
58
61
workerContext . EnvironmentVariables . Add ( WorkerConstants . FunctionsApplicationDirectorySettingName , _scriptRootPath ) ;
62
+ workerContext . EnvironmentVariables . Add ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , _environment . GetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName ) ) ;
59
63
foreach ( var pair in _hostingConfigOptions . Value . Features )
60
64
{
61
65
workerContext . EnvironmentVariables [ pair . Key ] = pair . Value ;
0 commit comments