File tree Expand file tree Collapse file tree 1 file changed +11
-16
lines changed
Expand file tree Collapse file tree 1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change 11import os
22import sys
3- import platform
4- import subprocess
3+
54from pathlib import Path
65
76# User packages
@@ -42,25 +41,21 @@ def determine_user_pkg_paths():
4241
4342
4443if __name__ == '__main__' :
45- user_pkg_paths = []
46- if is_azure_environment ():
47- user_pkg_paths = determine_user_pkg_paths ()
48-
49- env = os .environ
5044 # worker.py lives in the same directory as azure_functions_worker
5145 func_worker_dir = str (Path (__file__ ).absolute ().parent )
46+ env = os .environ
5247
53- if platform .system () == 'Windows' :
54- joined_pkg_paths = ";" .join (user_pkg_paths )
55- env ['PYTHONPATH' ] = f'{ joined_pkg_paths } ;{ func_worker_dir } '
56- # execve doesn't work in Windows: https://bugs.python.org/issue19124
57- subprocess .run ([sys .executable ,
58- '-m' , 'azure_functions_worker' ] + sys .argv [1 :],
59- env = env )
60- else :
61- joined_pkg_paths = ":" .join (user_pkg_paths )
48+ if is_azure_environment ():
49+ user_pkg_paths = determine_user_pkg_paths ()
50+
51+ joined_pkg_paths = os .pathsep .join (user_pkg_paths )
6252 env ['PYTHONPATH' ] = f'{ joined_pkg_paths } :{ func_worker_dir } '
6353 os .execve (sys .executable ,
6454 [sys .executable , '-m' , 'azure_functions_worker' ]
6555 + sys .argv [1 :],
6656 env )
57+ else :
58+ sys .path .insert (1 , func_worker_dir )
59+ from azure_functions_worker import main
60+
61+ main .main ()
You can’t perform that action at this time.
0 commit comments