boypt / vmess2json

Scripts parse vmess:// links into v2ray config json and vice versa.
MIT License
474 stars 126 forks source link

always require tty while thiere sys.stdin.isatty() is False #12

Open libook opened 3 years ago

libook commented 3 years ago

Execute vmess2json.py in non-tty environment with a single vmess URL.

There is an error from select_multiple function:

No such device or address: '/dev/tty'

In line 741:

if len(option.subscribe) > 0:

The value of option.subscribe is '-'.

In line 684-687:

    if sys.stdin.isatty():
        return None
    stdindata = sys.stdin.read()
    option.subscribe = "-"

When isatty returns False. It will continue run option.subscribe = "-".

I don't know about Python. Is this a bug? Hope these information may help you.

alamia442 commented 3 years ago

same here Traceback (most recent call last): File "./vmess2json.py", line 746, in select_multiple(stdin_data) File "./vmess2json.py", line 663, in select_multiple sys.stdin = open('/dev/tty', 'r') OSError: [Errno 6] No such device or address: '/dev/tty'

use python3 vmess2json.py or ./vmess2json.py sama error

20NE commented 2 years ago

and when vmess2json.py in bash script, like: yes n | ScriptWithVmess2json causes system hang.