Skip to content

Commit 2735750

Browse files
Parse output of zprocess.makesecret better
Apparently on Windows it ends in a blank line and on Unix it doesn't, so we need to look for the line we want instead of assuming it's the last one.
1 parent 6bb2067 commit 2735750

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

labscript_profile/create.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ def make_shared_secret(directory):
1414
"""Create a new zprocess shared secret file in the given directory and return its
1515
filepath"""
1616
cmd = [sys.executable, '-m', 'zprocess.makesecret']
17-
path = check_output(cmd, cwd=directory).decode('utf8').splitlines()[-1].strip()
18-
return Path(path)
17+
output = check_output(cmd, cwd=directory).decode('utf8')
18+
for line in output.splitlines():
19+
if 'zpsecret' in line and '.key' in line:
20+
return Path(line.strip())
21+
raise RuntimeError("Could not parse output of zprocess.makesecret")
1922

2023

2124
def make_labconfig_file():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy