Added debug information

This commit is contained in:
Anton Hvornum 2022-02-12 14:51:53 +01:00
parent 3e2c816b51
commit 80130b4898
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 3 additions and 2 deletions

View File

@ -335,7 +335,7 @@ class SysCommandWorker:
self.ended = time.time()
break
if self.ended or (got_output is False and pid_exists(self.pid) is False):
if pid_exists(self.pid) is False:
self.ended = time.time()
try:
self.exit_code = os.waitpid(self.pid, 0)[1]

View File

@ -181,12 +181,13 @@ class luks2:
os.path.basename(mountpoint) # TODO: Raise exception instead?
# print(f"Looking for phrase: 'Enter passphrase for {partition.path}'")
cryptworker = SysCommandWorker(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --type luks2')
cryptworker = SysCommandWorker(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --type luks2', peak_output=True)
# print(f'Looking for: Enter passphrase for {partition.path}')
pw_given = False
while cryptworker.is_alive():
if bytes(f'Enter passphrase for {partition.path}', 'UTF-8') in cryptworker and pw_given is False:
print('Entered the passphrase..')
cryptworker.write(password)
pw_given = True
time.sleep(0.25)