Jonny Weese <jwe...@gmail.com> added the comment:
> it seems strange/wrong to invoke an executable via "bash -c executable arg1 > arg2", rather than just "executable arg1 arg2"! I agree it's strange to invoke a single executable that way, but remember that -c allows a string of arbitrary bash code. (It just happens that bash code that consists of a single executable calls it -- useful behavior in a shell.) Consider: $ bash -c 'f() { printf "%s\n" "$@"; }; f "$@"' - foo bar baz foo bar baz > 1) If there exist use cases for setting `shell=True` and doing "bash -c > my_executable arg2 arg3", then the documentation should say something like > the following: > """ > Using `shell=True` invokes the sequence of args via `bash -c`. In this case, > the first argument MUST be an executable, and the subsequent arguments will > be stored as bash parameters for that executable (`$0`, `$1`, etc). > """ I'd be okay with clearer docs, but the given language is not quite right. For example, the actual shell call is /bin/sh (and depends on the platform). And, as described above, I think it would be too restrictive to say the first argument must be a single executable. On the other hand, I disagree with option 2. I think raising an error would be very restrictive, and secretly quoting the argument could be surprising for (the few) people who understand the underlying shell mechanism. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39692> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com