Skip to content

Commit

Permalink
Don't wait for lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenMPhillips committed Oct 23, 2024
1 parent 6febcb6 commit c9dab3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scripts/install_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def windows(self):
sys.exit(0)
else:
windows.run_elevated(
__file__, "--only-elevated --skip-python", wait_for_exit=True
__file__, "--only-elevated --skip-python"
)

qt = qt_utils.WindowsQt(*self.config.get_qt_config())
Expand Down
17 changes: 1 addition & 16 deletions scripts/lib/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import lib.env as env
from lib.certificate import Certificate

LOCK_FILE = "tmp/elevated.lock"
MSBUILD_CMD = "msbuild"
SIGNTOOL_CMD = "signtool"
CERTUTIL_CMD = "certutil"
Expand All @@ -30,14 +29,10 @@
MSI_FILE = f"{BUILD_DIR}/installer/bin/Release/Synergy.msi"


def run_elevated(script, args=None, use_sys_argv=True, wait_for_exit=False):
def run_elevated(script, args=None, use_sys_argv=True):
if not args and use_sys_argv:
args = " ".join(sys.argv[1:])

if wait_for_exit:
args += f" --lock-file {LOCK_FILE}"
env.persist_lock_file(LOCK_FILE)

command = f"{script} {args} --pause-on-exit"
print(f"Running script with elevated privileges: {command}")

Expand All @@ -63,16 +58,6 @@ def run_elevated(script, args=None, use_sys_argv=True, wait_for_exit=False):

print("Script is running with elevated privileges")

if wait_for_exit:
with open(LOCK_FILE, "r") as f:
pid = f.read()

print(f"Waiting for elevated process to exit: {pid}")
while os.path.exists(LOCK_FILE):
# Intentionally wait forever, since this code should not run where a developer
# has no control, such as in a CI environment.
pass


def is_admin():
"""Returns True if the current process has admin privileges."""
Expand Down

0 comments on commit c9dab3b

Please sign in to comment.