Skip to content

Commit

Permalink
Escape proper quote (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jawang35 authored Mar 29, 2019
1 parent ad56931 commit 639a76e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
host = instance.private_ip_address
connection = stack.enter_context(SSH(host, 'ec2-user', private_key))

escaped_command = command.replace('"', '\\"')
escaped_command = command.replace("'", "\\'")
print(f'Running command "{escaped_command}" on {host}...')
connection.run(f'exec $SHELL -l -c \'{escaped_command}\'')

0 comments on commit 639a76e

Please sign in to comment.