Skip to content

Commit f4c0172

Browse files
peterbarkertridge
authored andcommitted
mavproxy.py: strip enclosing quotes from parsed shlex results
A command-line of kml load "/home/pbarker/e0/sypaq/carbonix-flying-sites/Carbonix Flight Areas.kmz" gets turned into a 3-element list. Past this PR the last element will not be enclosed in quotes, which means that modules don't need to do their own quote-stripping
1 parent 884290c commit f4c0172

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

MAVProxy/mavproxy.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,18 @@ def process_stdin(line):
756756
print("Caught shlex exception: %s" % e.message);
757757
return
758758

759+
# strip surrounding quotes - shlex leaves them in place
760+
new_args = []
761+
for arg in args:
762+
done = False
763+
new_arg = arg
764+
for q in "'", '"':
765+
if arg.startswith(q) and arg.endswith(q):
766+
new_arg = arg[1:-1]
767+
break
768+
new_args.append(new_arg)
769+
args = new_args
770+
759771
cmd = args[0]
760772
while cmd in mpstate.aliases:
761773
line = mpstate.aliases[cmd]

0 commit comments

Comments
 (0)