How to bypass the 0-255 range limit for sys.exit() in python?

前端 未结 1 1063
余生分开走
余生分开走 2021-02-09 09:34

In python (on a Linux system), I\'m launching a command using os.system() and retrieving the return code. If that return code is different from 0, I would like to m

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-09 09:52

    Works for me (CentOS 5.5, Python 2.6.5):

    $ python
    >>> import sys
    >>> sys.exit(245)
    $ echo $?
    245
    

    0 讨论(0)
提交回复
热议问题