From 1647025aa413c7a7ac5ec154066219281cf1d663 Mon Sep 17 00:00:00 2001 From: Tibor Bizjak Date: Mon, 10 Apr 2023 22:49:00 +0200 Subject: [PATCH] Fixed pypy bug --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 2af6ecc..a7417d0 100755 --- a/main.py +++ b/main.py @@ -65,14 +65,15 @@ def get_cmd(fn): ext = fn.split('.')[-1] if ext == 'py': with open(fn) as f: - shebang = f.read().lstrip().split('\n')[0] - if shebang[:2] != '#!': - cmd = 'python ' - + fst_line = f.read().lstrip().split('\n')[0] + if fst_line[:2] != '#!': + return 'python ' + shebang = fst_line[2:] if pypy_installed: - return shebang[2:].replace('python', 'pypy') + ' ' + return shebang.replace('python', 'pypy') + ' ' if pypy3_installed: - return shebang[2:].replace('python3', 'pypy3') + ' ' + return shebang.replace('python3', 'pypy3') + ' ' + return shebang return './'