pre-upload: fix chdir/output finishing when running hooks
The current _run_project_hooks helper will call os.chdir but then return early before restoring its state to the previous location. To fix this, rip the core of _run_project_hooks into a new helper called _run_project_hooks_in_cwd, and then wrap that call in a try block so we can put the chdir call into the finally section. We have a similar problem with the output helper where we don't guarantee calling output.finish() before returning. To solve that, we have to rework the Output API slightly by delaying the setup of the num_hooks method to the point where we can calculate it. Bug: 124462370 Test: `repo upload` still works and summarizes across multiple repos Change-Id: I18780bcfe91db1cd276d7bdfdfd62badfc83a0d7
Loading
Please sign in to comment