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 './'