Record whether the empty-profile login launcher ran.
The receipt stores only called, rejected, or opened. It does not store the address. Assistant: grok Assistant-Session: 01a198fa-fd27-7e41-a0a2-57355c3e4efd
This commit is contained in:
parent
c89ac18d24
commit
8cb5b13c77
1 changed files with 19 additions and 1 deletions
|
|
@ -56,11 +56,24 @@ def launch_argv(browser, profile_dir, url):
|
|||
]
|
||||
|
||||
|
||||
def stamp(result):
|
||||
path = Path("/home/worsch/.local/state/railiance/receipts/operator-browser-last.txt")
|
||||
try:
|
||||
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
path.write_text(result + "\n", encoding="utf-8")
|
||||
os.chmod(path, 0o600)
|
||||
except OSError:
|
||||
return
|
||||
|
||||
|
||||
def main():
|
||||
stamp("called")
|
||||
if len(sys.argv) != 2 or not allowed(sys.argv[1]):
|
||||
stamp("rejected")
|
||||
return 1
|
||||
browser = browser_path()
|
||||
if not browser:
|
||||
stamp("no-browser")
|
||||
return 1
|
||||
profile = Path(tempfile.mkdtemp(prefix="operator-browser-"))
|
||||
os.chmod(profile, 0o700)
|
||||
|
|
@ -95,8 +108,13 @@ def main():
|
|||
stderr=subprocess.DEVNULL,
|
||||
timeout=20,
|
||||
)
|
||||
return int(opened.returncode != 0)
|
||||
if opened.returncode != 0:
|
||||
stamp("open-failed")
|
||||
return 1
|
||||
stamp("opened")
|
||||
return 0
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
stamp("open-failed")
|
||||
return 1
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue