Skip to content

Commit ed927df

Browse files
committed
[Bugfix] attach_run_wait() failes to run command with arguments
Generated ptr was invalid.
1 parent 8b1dd33 commit ed927df

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/container.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,10 @@ impl Container {
521521
program: &str,
522522
argv: &[&str],
523523
) -> super::Result<i32> {
524-
let argv_ptr = if argv.is_empty() {
525-
null()
526-
} else {
527-
let mut argv: Vec<*const i8> = argv.iter().map(|e| to_cstr(*e)).collect();
528-
529-
argv.push(null());
530-
531-
argv.as_ptr()
532-
};
524+
let mut argv_: Vec<*const i8> = argv.iter().map(|e| to_cstr(*e)).collect();
525+
argv_.push(null());
533526

534-
let pid = call!(self.attach_run_wait(options, to_cstr(program), argv_ptr));
527+
let pid = call!(self.attach_run_wait(options, to_cstr(program), argv_.as_ptr()));
535528

536529
if pid == -1 {
537530
Err(self.last_error())

0 commit comments

Comments
 (0)