Reputation: 1
So I have a program that is passing down commands to a remote host and using shlex library to parse the args that way a incompleted quotation will not be sent down. And I notice this behavior
here is my intended behavior and working behavior on a string like this:
>>> lexer = shlex.shlex('"aaaaaaaaaaaaaaaa')
>>> list(lexer)
ValueError: No closing quotation
However for
>>> lexer = shlex.shlex('"\\"')
>>> list(lexer)
['"\\"']
Which of course when I run this on the remote host we are getting a waiting since its running this in bash "\"
. I would expect the above input to also give me a Value Error since the string is not closed.
Is this shlex intended behavor and if so why?
Upvotes: 0
Views: 23