lxc/ruby-lxc

zombie process after (attach and run_command)

fanyeren opened this issue · 3 comments

require 'lxc'

c = LXC::Container.new('foo')
c.create('ubuntu')
c.start
c.attach do
LXC.run_command('/sbin/ifconfig')
end
c.stop
c.destroy

after i execute this script,i found ifconfig process become a zombie process

zombie process after (attach and run_command)

i've tried
pid = c.attach do
LXC.run_command('/sbin/ifconfig')
end
Process.wait(pid)

and this problem is fixed

You can also call

c.attach(wait: true) do
  ...
end
# No Process.wait needed

I'm considering switching the wait flag to default to true, but that would be only for 2.0.0.