Which shell is starting up?
This is stated in the Python subprocess documentation :
The executable file argument indicates the executable program. This is very rarely necessary: ββusually the executable program is specified by the args argument. If shell = True, the executable argument indicates which shell to use. On Unix, the default shell is /bin/sh . On Windows, the default shell is specified by the COMSPEC environment variable. The only reason you need to specify shell=True on Windows is where the command you want to execute is really built into the shell, for example, dir, copy. You do not need the shell = True to run the batch file or to run the console-based executable.
/bin/sh on Linux / MacOSX is usually an alias for bash (or bash -compatible - newer versions of Debian using dashes), while on Unix, like Solaris, it can be a classic Bourne shell.
For Windows, usually cmd or command.bat .
Enter the shell or not through popen ?
I just realized that I did not answer your second question, but setting shell=True will generate a non-login shell (see the link to the source code @AndiDog, the way the shell gets forked will create a shell without login).
Safety implications
Also keep in mind that using shell=True , although it allows you to use primitives and shortcuts for the shell, can also be a security risk , so be sure to check any possible inputs that you can use to spawn the process.
Warning Executing shell commands that include unanimated input from an untrusted source makes the program vulnerable to shell injection, a serious security issue that could lead to arbitrary command execution. For this reason, the use of shell = True is very discouraged in cases where the command line is built from external input:
>>> >>> from subprocess import call >>> filename = input("What file would you like to display?\n") What file would you like to display? non_existent; rm -rf /
shell=False disables all shell-based functions, but does not suffer from this vulnerability; see the note in the Popen constructor documentation for useful tips on how to make shell = False work.