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 1
1
import os
2
2
import sys
3
- import platform
4
- import subprocess
3
+
5
4
from pathlib import Path
6
5
7
6
# User packages
@@ -42,25 +41,21 @@ def determine_user_pkg_paths():
42
41
43
42
44
43
if __name__ == '__main__' :
45
- user_pkg_paths = []
46
- if is_azure_environment ():
47
- user_pkg_paths = determine_user_pkg_paths ()
48
-
49
- env = os .environ
50
44
# worker.py lives in the same directory as azure_functions_worker
51
45
func_worker_dir = str (Path (__file__ ).absolute ().parent )
46
+ env = os .environ
52
47
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 )
62
52
env ['PYTHONPATH' ] = f'{ joined_pkg_paths } :{ func_worker_dir } '
63
53
os .execve (sys .executable ,
64
54
[sys .executable , '-m' , 'azure_functions_worker' ]
65
55
+ sys .argv [1 :],
66
56
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