Help needed, killing a process isn't...

roger peppe roger.peppe at canonical.com
Mon May 20 09:00:47 UTC 2013


On 20 May 2013 05:26, Tim Penhey <tim.penhey at canonical.com> wrote:
> The problem is that the outer cmd.Wait() still waits for the entire
> process to finish before saying "sorry, signal 9" by way of the error
> value.  The command being executed is just sitting in /bin/sleep.  This
> should be very easily interrupted, but for some reason doesn't seem to be.
>
> I've already spent some time this afternoon chasing this, and not
> getting anywhere, so I'm reaching out.
>
> Anyone got any clues?

The problem is that your Kill only kills bash, not the sleep
process that it's running. Since you're trying to save the output,
exec.Command.Wait waits for EOF, but that only happens when
the sleep exits.

You can fix it by using "sleep sleep-time > /dev/null 2>&1" in
your generated shell script.

BTW I think that we're trying to be too clever here. If there's
a command that takes a while to generate its description,
so what? Putting arbitrary timeouts in regular code seems
wrong to me; if someone has a broken command installed,
wouldn't  a reasonable way to find out what's going on be
just to run --verbose and see that we're hanging up trying
to get a description? (assuming we have appropriate logging
statements in the code of course). Less code and arguably
more correct.

  cheers,
    rog.



More information about the Juju-dev mailing list