Python by itself does no such thing. Perhaps the shell=True
is doing more than you hoped or bargained for? But we would need access to your shell's configuration to get beyond mere speculation around this.
Calling Popen
on the result from Popen
is obviously not well-defined; but perhaps this is just an error in your transcription of your real code?
Removing the first process =Popen(
would fix this with minimal changes. As per the above, I would also remove shell=True
as at least superfluous and at worst directly harmful.
commandLine = 'tf changeset /noprompt /latest /loginType:OAuth /login:.,***'
process = Popen(commandLine, stdout=PIPE, stderr=PIPE)
Like the subprocess
documentation tells you, shell=True
is only useful on Windows when your command is a cmd
built-in.
For proper portability, you should break the command into tokens, manually or by way of shlex.split()
if you are lazy or need the user to pass in a string to execute.
commandLine = ['tf ', 'changeset', '/noprompt', '/latest', '/loginType:OAuth', '/login:.,***']
process = Popen(commandLine, stdout=PIPE, stderr=PIPE)
This avoids the other dangers of shell=True
and will be portable to non-Windows platforms (assuming of course that the command you are trying to run is available on the target platform).