Closed dierbei closed 1 year ago
The call to wait_with_output is causing your program to "stall" (or rather, wait for the child process to finish) indefinitely.
Simultaneously waits for the child to exit and collect all remaining output on the stdout/stderr handles, returning an Output instance.
Can you confirm that you can run this command from the CLI and it return?
I am guessing your desired behavior is to
@SpBills Yes, my purpose is to collect the stdout and stderr of the child process.
In fact, the more confusing part is that it can be created by executing commands directly on the shell terminal.
But the Rust program is blocking, which confuses me a lot.
For example, after I execute the following command on the command line, it will not block.
root@ecsHyNL:~/golang/test-rnc# runc --log-format json create -b /mycontainer example
root@ecsHyNL:~/golang/test-rnc#
@SpBills Yes, my purpose is to collect the stdout and stderr of the child process.
In fact, the more confusing part is that it can be created by executing commands directly on the shell terminal.
But the Rust program is blocking, which confuses me a lot.
For example, after I execute the following command on the command line, it will not block.
root@ecsHyNL:~/golang/test-rnc# runc --log-format json create -b /mycontainer example root@ecsHyNL:~/golang/test-rnc#
Huh, that's weird. I am going to give you the benefit of the doubt that you are running the command in the same environment that you are running the Rust program too.
I do get a feeling it has something to do with env variables though, as programmatic container problems often are.
After doing some testing, it looks like Command::new
automatically inherits the parent environment. However, due to setuid, it probably has some permissions issues. Can you try chmod u+s <file_path>
on your file executable?
@SpBills Thanks for the suggestion, I also think it's a problem with the container.
I tried the following steps to run the rust program, still the same problem.
I haven't thought of a solution so far.
Creating an OCI Bundle
I tried this code:
I expected to see this happen: explanation
The hope is to perform some operations after creating. It seems that no results have been returned.
Meta
rustc --version --verbose
:Backtrace
```
```