Created
May 12, 2011 16:50
-
-
Save engie/968920 to your computer and use it in GitHub Desktop.
Possible problem with busybox sh handling of pipes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/tmp $ cat spawnShortPipeSleep.sh | |
#!/bin/sh | |
sleep 5 | logger -t ZZZZZ & | |
Running this under bash: | |
/tmp $ bash --version | |
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) | |
Running this under bash returns immediately: | |
/tmp $ bash -c "./spawnShortPipeSleep.sh" | |
***Returns immediately*** | |
Piping the output to another process, returns immediately : | |
/tmp $ bash -c "./spawnShortPipeSleep.sh | logger -t SPAWN" | |
***Returns immediately*** | |
Running this under busybox: | |
root@navetas ~$ sh --version | |
BusyBox v1.15.0 () built-in shell (ash) | |
Enter 'help' for a list of built-in commands. | |
Running this under sh returns immediately: | |
root@navetas ~$ sh -c "./spawnShortPipeSleep.sh" | |
***Returns immediately*** | |
Piping the output to another process, returns after 5s : | |
root@navetas ~$ sh -c "./spawnShortPipeSleep.sh | logger -t SPAWN" | |
*** Returns when the 5s sleep finishes! *** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment