def run_clean(args: Args, config: Config, *, resources: Path) -> None:
- if not needs_clean(args, config):
- return
-
become_root()
# We remove any cached images if either the user used --force twice, or he/she called "clean" with it
# First, process all directory removals because otherwise if different images share directories a later
# image build could end up deleting the output generated by an earlier image build.
for config in images:
- fork_and_wait(run_clean, args, config, resources=resources)
+ if needs_clean(args, config):
+ fork_and_wait(run_clean, args, config, resources=resources)
if args.verb == Verb.clean:
return