[issue5870] subprocess.DEVNULL
Roundup Robot devnull@devnull added the comment: New changeset eaf93e156dff by Ross Lagerwall in branch 'default': Issue #5870: Add subprocess.DEVNULL constant. http://hg.python.org/cpython/rev/eaf93e156dff -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by Ross Lagerwall rosslagerw...@gmail.com: -- assignee: gregory.p.smith - rosslagerwall resolution: - accepted stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by Ned Deily n...@acm.org: -- nosy: +mmarkk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by Santoso Wijaya santoso.wij...@gmail.com: -- nosy: +santa4nt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Georg Brandl ge...@python.org added the comment: Hmm, we don't like these open-for-eternity file descriptors; we had such a thing for os.urandom() but removed it (see #1177468). I'm okay with DEVNULL (or even just NULL) as a shorthand, but it should open (and close) the devnull device each time just as if a normal fd was given. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Ross Lagerwall rosslagerw...@gmail.com added the comment: I think if you look closely at the patch, the fd does not stay open the whole time. It is opened if necessary in _get_handles() with e.g.: elif stdin == DEVNULL: p2cread = self._get_devnull() and then closed in _execute_child() with: if hasattr(self, '_devnull'): os.close(self._devnull) which is executed from __init__(). So I don't think it stays open for eternity :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Georg Brandl ge...@python.org added the comment: Right, sorry then :) -- assignee: - gregory.p.smith nosy: +gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Ross Lagerwall rosslagerw...@gmail.com added the comment: Here is a fairly simple patch that adds the subprocess.DEVNULL constant. -- keywords: +patch nosy: +rosslagerwall versions: +Python 3.3 -Python 2.7 Added file: http://bugs.python.org/file20215/5870_v1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by Amaury Forgeot d'Arc amaur...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Lucas Prado Melo lucaspradom...@gmail.com added the comment: -1 on this one. It is not a portable decision (only *nix OSes do have /dev/null). Also, why would we want it as a default constant? The subprocess module would need to open /dev/null every time. Despite that, I can't see how would someone use the redirection of errors to /dev/null through a python script and, at the same time, make it seem not a bad practice at all. -- nosy: +lucaspmelo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Antoine Pitrou pit...@free.fr added the comment: Lucas, Windows has a /dev/null-like device. I think Jean's suggestion is reasonable, but it should be a special constant instead of creating a file descriptor unconditionnally (that is, the file should only be open if needed). Also, a patch should be provided (with tests :-)). -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
Changes by OG7 ony...@users.sourceforge.net: -- nosy: +OG7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5870] subprocess.DEVNULL
New submission from Jean Brouwers mrje...@gmail.com: The subprocess module exposes the PIPE and STDOUT constants to be used for the stdin, stdout or stderr keyword arguments. Often, stderr needs to be redirected to /dev/null (on posix). It would nice if another constant was available for that purpose, e.g. subprocess.DEVNULL. Perhaps, that might be as simple as DEVNULL = os.open(os.devnull, os.OS_RDWR) and re-use the same, single file descriptor. -- components: Extension Modules messages: 86761 nosy: MrJean1 severity: normal status: open title: subprocess.DEVNULL type: feature request versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5870 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com