Re:CLI Guidelines – A guide to help you write better command...
by colejohnson66 on Friday December 04, 2020 @07:37PM
(#25310345)
Wait... So it’s possible to make it so you can’t use `quit()`? Just overwrite it without saving it?
[ Parent
| on HN ]
Re:CLI Guidelines – A guide to help you write better command...
by cle on Friday December 04, 2020 @07:58PM
(#25310513)
Yes. You can still send an EOF to quit (ctrl+d), or do "raise SystemExit()" which is all quit() does anyway:
>>> print(inspect.getsource(quit.__call__))
def __call__(self, code=None):
try:
sys.stdin.close()
except:
pass
raise SystemExit(code)