mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
25 lines
494 B
Text
Executable file
25 lines
494 B
Text
Executable file
#!/usr/bin/env xonsh
|
|
res = True
|
|
script = """import os
|
|
path = "/proc/{}/cmdline".format(os.getpid())
|
|
with open(path, "r") as f:
|
|
lines = f.read().split("\x00")
|
|
print(lines[0])"""
|
|
|
|
def check(python):
|
|
argv0 = $(@(python) -c @(script)).rstrip()
|
|
|
|
if argv0 == python:
|
|
return True
|
|
|
|
print("Unexpected argv[0]: {} != {}".format(argv0, python))
|
|
return False
|
|
|
|
|
|
python = "python"
|
|
res &= check(python)
|
|
|
|
python = $(which -s python)
|
|
res &= check(python)
|
|
if res:
|
|
print("OK")
|