Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow pipes in commands #7

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

theomega commented Dec 12, 2011

The current implementation does not allow to specify pipes as commands.

So watch 'ls | grep txt' fails, even worse without a clear error-message:

waitpid(): No child processes
exit: 1

This comes from the fact that the old watch implementation uses the system function to execute the commands. This function uses a shell which handles the pipes. execvp does not support pipes in its commands, you would have to set them up by yourself.

The following patch changes some things:

  • Per default execute thru system
  • Add a -x/--exec flag which switches back to the old behaviour
  • Output a correct error-message on execvp errors.

This makes watch more usable and more compliant to the original implementation.

Owner

tj commented Dec 12, 2011

haha good call with system, I didn't even think about pipelines for some reason. I'll check it out tomorrow

@tj tj closed this in be22d2a Dec 17, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment