@@ -31,7 +31,7 @@ if os.path.isdir(os.path.join(PARENT_FOLDER, '.venv')):
31
31
sys .path .insert (0 , PARENT_FOLDER )
32
32
33
33
# names of additional environment variables to pass to subprocess
34
- ENV_VARS_TO_PASS = ['PATH' , 'PYTHONPATH' , 'SYSTEMROOT' , 'HOME' ]
34
+ ENV_VARS_TO_PASS = ['PATH' , 'PYTHONPATH' , 'SYSTEMROOT' , 'HOME' , 'TERM' , 'PAGER' ]
35
35
36
36
from localstack_client import config # noqa: E402
37
37
@@ -54,24 +54,13 @@ def usage():
54
54
print (__doc__ .strip ())
55
55
56
56
57
- def run (cmd , env = {}):
58
-
59
- def output_reader (pipe , out ):
60
- out_binary = os .fdopen (out .fileno (), 'wb' )
61
- with pipe :
62
- for line in iter (pipe .readline , b'' ):
63
- out_binary .write (line )
64
- out_binary .flush ()
65
-
66
- process = subprocess .Popen (
67
- cmd , env = env ,
68
- stderr = subprocess .PIPE , stdout = subprocess .PIPE , stdin = subprocess .PIPE )
69
-
70
- Thread (target = output_reader , args = [process .stdout , sys .stdout ]).start ()
71
- Thread (target = output_reader , args = [process .stderr , sys .stderr ]).start ()
72
-
73
- process .wait ()
74
- sys .exit (process .returncode )
57
+ def run (cmd , env = None ):
58
+ """
59
+ Replaces this process with the AWS CLI process, with the given command and environment
60
+ """
61
+ if not env :
62
+ env = {}
63
+ os .execvpe (cmd [0 ], cmd , env )
75
64
76
65
77
66
def awscli_is_v1 ():
0 commit comments