Redirection of stdout for commands
sleepy_dog at gmx.de
sleepy_dog at gmx.de
Fri Oct 8 14:14:48 UTC 2021
Hello there,
1st time post here.
On a BusyBox based system (image built recently) I have a program
calling external executables and reading their text output.
This is done with fork, execl, and beforehand, redirecting the output
with dup2, quite like here:
https://dzone.com/articles/simple-popen2-implementation
This generally works. There is one oddity, when calling Linux commands
with this method:
Depending on whether I run that same program on a regular distribution
Linux machine, or on BusyBox, I get different results.
It works as expected on e.g. Ubuntu.
On BusyBox, it's different:
- if I call only BusyBox with "busybox --help", rhings work as expected,
e.g. nothing spills to the console, and I read all the input vie my
redirected stdout
- if I call a command handle by busybox, e.g. "dd --help", I get back
nothing from stdout, and all text output spills directly on the console
- if I call busybox explicitly, with the command added, like "busybox dd
--help", it's the same as previous, i.e. doesn't work
Why is this, and can I make it work?
Thanks,
- Steve
More information about the busybox
mailing list