python - Is there any way to get the full command line that's executed when using subprocess.call? -


i'm using subprocess.call give array of argumets , build command line , execute it.

first of there escaping involved? (for example if pass argument path file has spaces in it, /path/my file.txt escaped? "/path/my file.txt")

and there way command line that's generated (after escaping , all) before being executed?

as need check if generated command line not longer amount of characters (to make sure not give error when gets executed).

if you're not using shell=true, there isn't "command line" involved. subprocess.popen passing argument list underlyingexecve() system call.

similarly, there's no escaping, because there's no shell involved , hence nothing interpret special characters , nothing going attempt tokenize string.

there isn't character limit worry because arguments never concatenated single command line. there may limits on maximum number of arguments and/or length of individual arguments.

if are using shell=true, have construct command line before passing subprocess.


Comments