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

Tim Penhey tim.penhey at canonical.com
Mon May 20 04:26:56 UTC 2013


I started working on the plugin stuff on the last day of the sprint, and
on the way home.  Today I was working on the discovourability.

The aim here is to do the following:
  Walk the path looking for juju-* files that are executable DONE
  Call each of these files with --description and return the first line DONE
  If the call takes too long (> some duration), we kill the process and
give the description "error: took too long" or something similar.

Dave was very helpful today and gave me some code that mostly did this.

I now have it in my branch:

  lp:~thumper/juju-core/plugin-description

The plugin tests can be run with:

  cd cmd/juju
  go test -gocheck.f PluginSuite

The test I'm having problems with in particular is TestGatherDescriptions.

There is currently print statements throughout the GatherDescriptions
method as I'm trying to work things out.

The command is being executed through exec.Command, and the resulting
command is killed using:
  result.err = cmd.Process.Kill()

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?

Cheers,
Tim



More information about the Juju-dev mailing list