Skip to content

Commit c05f31b

Browse files
committed
Allow for piping the output into other commands
1 parent 80add94 commit c05f31b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

awsshell/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def main():
9393
# is .edit.
9494
if text.startswith('.edit'):
9595
# Hardcoded VIM editor for now. It's for demo purposes!
96-
all_commands = '\n'.join([h for h in list(history) if not
97-
h.startswith(('.', '!'))])
96+
all_commands = '\n'.join(
97+
['aws ' + h for h in list(history)
98+
if not h.startswith(('.', '!'))])
9899
with tempfile.NamedTemporaryFile('w') as f:
99100
f.write(all_commands)
100101
f.flush()
@@ -106,9 +107,7 @@ def main():
106107
full_cmd = text[1:]
107108
else:
108109
full_cmd = 'aws ' + text
109-
p = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE)
110-
for line in p.stdout:
111-
sys.stdout.write(line)
110+
p = subprocess.Popen(full_cmd, shell=True)
112111
p.communicate()
113112

114113

0 commit comments

Comments
 (0)