escape single quotes in the command stream so as not to confuse the shlex parser

This commit is contained in:
Lincoln Stein 2022-08-23 13:46:50 -04:00
parent 7a67d3d837
commit 3a58988e4a

View File

@ -107,6 +107,10 @@ def main_loop(t2i,parser,log,infile):
if command.startswith(('#','//')): if command.startswith(('#','//')):
continue continue
# before splitting, escape single quotes so as not to mess
# up the parser
command = command.replace("'","\\'")
try: try:
elements = shlex.split(command) elements = shlex.split(command)
except ValueError as e: except ValueError as e: