Refactor cmd path check using startswith() (#3117)

This commit is contained in:
codefiles 2025-01-13 22:22:47 -05:00 committed by GitHub
parent b7a5d00676
commit d5bbda1e2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -115,9 +115,8 @@ class SysCommandWorker:
if isinstance(cmd, str):
cmd = shlex.split(cmd)
if cmd:
if cmd[0][0] != '/' and cmd[0][:2] != './': # Path() does not work well
cmd[0] = locate_binary(cmd[0])
if cmd and not cmd[0].startswith(('/', './')): # Path() does not work well
cmd[0] = locate_binary(cmd[0])
self.cmd = cmd
self.callbacks = callbacks or {}