Refactor cmd/arg list for iexe_cmd
# Hack to tokenize the commandline that should be executed. # We probably should "Do the Right Thing (tm)" at some point command_list = shlex.split(cmd.encode('utf8'))
This ticket is to "Do the Right Thing (tm)".
#2 Updated by Anthony Tiradani over 7 years ago
- Status changed from Assigned to Resolved
The comment was put in place for two reasons.
At the time, I had not tested shlex to determine what it would do with corner cases, like quoted strings, special character, or if it would attempt to type cast arguments. e.g. change "cmd arg1 2 3" to ["cmd", "arg1", 2, 3]
Second, everywhere in code, we build the command as if we are typing it out on the terminal. This is the way that the original popen calls expected input. Now, subprocess.popen expects a list. The thought was that we might want to change that eventually in code to provide a list instead of the command line string.
I discussed it with Doug and he tested a few corner cases. We are satisfied that it works as expected, and Doug will change the comments accordingly.