Implement LXC::run_command
This commit is contained in:
parent
d06cb87dee
commit
9d78dac57e
21
ext/lxc.c
21
ext/lxc.c
|
@ -1136,6 +1136,24 @@ container_wait(int argc, VALUE *argv, VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
lxc_run_command(VALUE self, VALUE rb_command)
|
||||
{
|
||||
int ret;
|
||||
lxc_attach_command_t cmd;
|
||||
VALUE rb_program;
|
||||
|
||||
rb_program = rb_ary_shift(rb_command);
|
||||
cmd.program = StringValuePtr(rb_program);
|
||||
cmd.argv = ruby_to_c_string_array(rb_command);
|
||||
|
||||
ret = lxc_attach_run_command(&cmd);
|
||||
if (ret == -1)
|
||||
rb_raise(Error, "unable to run command");
|
||||
/* NOTREACHED */
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
lxc_default_config_path(VALUE self)
|
||||
{
|
||||
|
@ -1200,8 +1218,7 @@ Init_lxc(void)
|
|||
|
||||
//rb_define_singleton_method(LXC, "arch_to_personality",
|
||||
// lxc_arch_to_personality, 1);
|
||||
//rb_define_singleton_method(LXC, "attach_run_command",
|
||||
// lxc_attach_run_command, 0);
|
||||
rb_define_singleton_method(LXC, "run_command", lxc_run_command, 0);
|
||||
//rb_define_singleton_method(LXC, "attach_run_shell",
|
||||
// lxc_attach_run_shell, 0);
|
||||
rb_define_singleton_method(LXC, "default_config_path",
|
||||
|
|
Loading…
Reference in a new issue