dispatchc-conf does not work with eshell: Error message: ==== Traceback (most recent call last): File "/usr/lib/python-exec/python3.11/dispatch-conf", line 619, in <module> d.grind(portage.util.shlex_split(portage.settings.get("CONFIG_PROTECT", ""))) File "/usr/lib/python-exec/python3.11/dispatch-conf", line 341, in grind clear_screen() File "/usr/lib/python-exec/python3.11/dispatch-conf", line 568, in clear_screen sys.stdout.write(_unicode_decode(curses.tigetstr("clear"))) TypeError: write() argument must be str, not None ==== It's quite simple to fix this by changing clear_screen() to something like this: ```python def clear_screen(): if curses is not None: try: curses.setupterm() clear_str = curses.tigetstr("clear") if clear_str is not None and os.isatty(sys.stdout.fileno()): sys.stdout.write(_unicode_decode(clear_str)) sys.stdout.flush() return except curses.error: pass os.system("clear 2>/dev/null") ``` Now it can handle running in emacs eshell without flushing it. A modification like this one should provide a wider support for different shells and terminal environments in general.
Out of curiosity, does the os.system("clear 2>/dev/null") part actually clear the screen for eshell? Anyway, it seems like we should definitely handle the None return value from curses.tigetstr, since documentation clearly says it can return None in some cases: https://docs.python.org/3/library/curses.html#curses.tigetstr
(In reply to Zac Medico from comment #1) > Out of curiosity, does the os.system("clear 2>/dev/null") part actually > clear the screen for eshell? Nope, it does not flush the screen. I don't think it'd be possible to flush the screen in eshell unless we try to use something like `subprocess.run(["emacsclient", "--eval", "(eshell/clear-scrollback)"])` but I wouldn't advise that, since flushing the screen is not a must have requirment for dispatch-conf to work properly AFAIK.
extra: the use of the word "flushing" in my above comment is not accurate. I think you get the point still though.