Comment 3 for bug 1854338

Revision history for this message
John A Meinel (jameinel) wrote : Re: [2.7-rc6] Invalid exec format for a hook file does not result in unit error

Digging through the code, the issue is that if ps.Start() returns an error, then we trigger a code path that doesn't wait for the process to exit (which is correct), but then we don't handle the error correctly, because the rest of the code is *only* looking at the exit error.
Something like:

--- a/worker/uniter/runner/runner.go
+++ b/worker/uniter/runner/runner.go
@@ -515,6 +515,8 @@ func (runner *runner) runCharmHookOnLocal(hookName string, env []string, charmLo
                runner.context.SetProcess(hookProcess{ps.Process})
                // Block until execution finishes
                exitErr = ps.Wait()
+ } else {
+ exitErr = err
        }
        // Ensure hook loggers are stopped before reading stdout/stderr
        // so all the output is captured.

should fix this case.