Robotframework: `Process`: Add option to disable stdout and stderr

Created on 29 Nov 2019  路  5Comments  路  Source: robotframework/robotframework

The option should be added to 'Run Process' arguments to use stdout=NULL or stdout=NONE to disable writing stdout/stderr in general. Same that you can do in shell with > /dev/null.

acknowledge beta 1 enhancement good first issue medium

Most helpful comment

PR is on it's way once I've updated the docs and added comments and tests. Preliminary coding and testing looks good. I just need to test this on Linux & Mac for both Python 2 and Python 3 interpreters to be 100% sure.

All 5 comments

This would be handy. You obviously can already now redirect stdout/stderr to a temp file and remove it after execution, but if you aren't interested in output at all, discarding it altogether is even more convenient.

The subprocess module that the Process library uses internally has DEVNULL constant for this exact purpose and we could use it the same way we already support STDOUT like stderr=STDOUT. A problem is that Python 2.7 doesn't have that constant, but StackOverflow shows how to use os.devnull in that case.

Anyone interested to implement this? Could still make it to RF 3.2. It's very unlikely I have time for it but would be happy to review PRs.

The new config should be DEVNULL to be consistent with subprocess. It should work both with stdout and stderr.

PR is on it's way once I've updated the docs and added comments and tests. Preliminary coding and testing looks good. I just need to test this on Linux & Mac for both Python 2 and Python 3 interpreters to be 100% sure.

My third PR: https://github.com/robotframework/robotframework/pull/3412. This one incorporates the recommendations @pekkaklarck gave me and I think it is really close to final. All tests including new tests are passing on both Windows and OSX platforms so looking good. The documentation has been updated with a paragraph describing the new DEVNULL option for stdout and stderr. There is also an example showing how to use this new functionality.

Thanks @adrianyorke for the great PR! Third time鈥檚 the charm. :smiley:

Was this page helpful?
0 / 5 - 0 ratings