Repository navigation
Silence pager stderr - #11864
Silence pager stderr#11864
Conversation
This is run as a test to determine if a pager is available. If there is no pager, there is a fallback. Therefore, I think it is a bug that in the no-pager case ipython will print sh: less not found To stderr.
| # if I use popen4, things hang. No idea why. | ||
| #pager,shell_out = os.popen4(pager_cmd) | ||
| pager = os.popen(pager_cmd, 'w') | ||
| pager = os.popen(pager_cmd + ' 2>/dev/null', 'w') |
There was a problem hiding this comment.
Hum, wondering if we should use subprocess.Popen . Potentially subprocess.run now that this is available and properly discard stderr. I'm worried about string munging... but I may just be lazy and merge that as is later.
There was a problem hiding this comment.
I don't have enough experience with passing stdin to subprocess.Popen to be sure to cover all the edge-cases are covered in the same way they are covered now.
There was a problem hiding this comment.
I don't have enough experience with passing stdin to
subprocess.Popento be sure to cover all the edge-cases are covered in the same way they are covered now.
Then don't worry I'll push a commit on this branch if I decide subprocess.Popen is better.
Maybe not this week though.
There was a problem hiding this comment.
Yes sorry Aug/Sep/Oct were crazy with my team size at work decreasing by 33%... Slowly getting out of the tarpit.
This should in particular work on windows; as 2>/dev/null might not have been proper windows syntax
|
I (finally) pushed some changes; would you mind having a look and let me know if that fixes your case ? |
| stdin=subprocess.PIPE, | ||
| stderr=subprocess.DEVNULL | ||
| ) | ||
| pager = os._wrap_close(io.TextIOWrapper(proc.stdin), proc) |
There was a problem hiding this comment.
Should we really use a function that is not part of the public API? What is the intention here?
There was a problem hiding this comment.
In this case I believe this is ok, as this is exactly what os.popen call. There is not much reason for it to change.
|
I can't reproduce the issue reliably, but since stderr is suppressed it should fix my issue. |
This is run as a test to determine if a pager is available. If there is
no pager, there is a fallback. Therefore, I think it is a bug that in
the no-pager case ipython will print
sh: less not found
To stderr.
I encountered this when running the sagemath testsuite on a machine without less and got surprised by the error messages.