lxc / ruby-lxc

ruby bindings for liblxc
https://linuxcontainers.org/lxc
GNU Lesser General Public License v2.1
134 stars 29 forks source link

zombie process after (attach and run_command) #29

Closed fanyeren closed 9 years ago

fanyeren commented 9 years ago

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

fanyeren commented 9 years ago

zombie process after (attach and run_command)

fanyeren commented 9 years ago

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

and this problem is fixed

andrenth commented 9 years ago

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.