Weirdness in hook execution logger
John Meinel
john at arbash-meinel.com
Mon Apr 8 13:10:41 UTC 2013
Since you aren't in the subprocess, isn't this just closing the write side
to the subprocess's stdin? Imagine the child was "cat". You have to tell it
you are done writing before the child will stop.
John
=:->
On Apr 8, 2013 3:26 AM, "Tim Penhey" <tim.penhey at canonical.com> wrote:
> Hi All,
>
> Was reading some code today and came across the following:
>
> in worker/uniter/context.go, in method:
>
> func (ctx *HookContext) RunHook(hookName, charmDir, toolsDir, socketPath
> string) error {
>
> we have the following
>
> outReader, outWriter, err := os.Pipe()
> // [snippity]
> go logger.run()
> err = ps.Start()
> outWriter.Close()
> if err == nil {
> err = ps.Wait()
> }
> logger.stop()
>
> Now here it looks as if we are closing the writer part of the pipe
> before the process has finished executing. This looks suspicious to me,
> and my first thought is that something is wrong.
>
> Is this a bug? Am I missing something?
>
> If this isn't a bug, what should a comment say before hand so the next
> person who looks at this code doesn't wonder the same thing.
>
> However, my first thought still is that this is wrong, but if I'm wrong,
> I'd like to know why, and better now than in a code review.
>
> Cheers,
> Tim
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20130408/cddc8138/attachment.html>
More information about the Juju-dev
mailing list