Added real disk format section

* --dry-run=True safety wheels still engaged
This commit is contained in:
2Shirt 2020-01-02 21:22:47 -07:00
parent ac04a3ddc5
commit 9ae8810282
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 14 additions and 4 deletions

View file

@ -78,7 +78,7 @@ def build_cmd_kwargs(cmd, minimized=False, pipe=True, shell=False, **kwargs):
}
# Add additional kwargs if applicable
for key in ('check', 'cwd', 'encoding', 'errors', 'stderr', 'stdout'):
for key in 'check cwd encoding errors stderr stdin stdout'.split():
if key in kwargs:
cmd_kwargs[key] = kwargs[key]

View file

@ -701,10 +701,20 @@ class State():
with open(script_path, 'w') as _f:
_f.write('\n'.join(sfdisk_script))
# Skip real format for dry runs
if dry_run:
return
# Format disk
if not dry_run:
# TODO
pass
with open(script_path, 'r') as _f:
proc = exe.run_program(
cmd=['sudo', 'sfdisk', self.destination.path],
stdin=_f,
check=False,
)
if proc.returncode != 0:
std.print_error('Error(s) encoundtered while formatting destination')
raise std.GenericAbort()
# Update settings
settings['Needs Format'] = not dry_run