cpipe Release Notes Version 0.77 (beta) cpipe is not supported by Perforce Software. cpipe is a skunkworks project authored by Michael Shields, who happens to be employeed by Perforce Software as a Technical Support Engineer. cpipe was developed on my own time, and when possible, will be supported and enhanced on my own time. If you have a problem or suggestion regarding cpipe, please email me at mshields@perforce.com. cpipe is provided "as is", without a warranty of any kind. All express or implied representations and warranties, including any implied warranty of merchantability, fitness for a particular purpose, or non-infringement, are hereby excluded. Description ----------- cpipe is an implementation of a conditional pipe. cpipe can be used to optimize a pipe when continuing to execute through the pipe is unnecessary when no data is present in the pipe. This optimization can have performance benefits when the startup costs are non-trivial (e.g. locking files) for a program in a pipe. Usage ----- The syntax for cpipe is: cpipe command [command-arguments] where the command is executed if and only if there are bytes present on cpipe's standard input. If there are bytes present, they are forwarded to the command's standard input. If the command is executed, the command-arguments are passed to the command. cpipe appends a "-" argument to the command-arguments, so that the command knows that the input is on it's standard input. Examples -------- Given the two files: $ cat data.txt There is data here. A couple of lines, anyway. $ cat alive.txt The pipe is alive! then the pipe: cat data.txt | cpipe cat alive.txt results in the following output: The pipe is alive! There is data here. A couple of lines, anyway. In the above example, the cat data.txt pipes bytes to cpipe's standard input. With bytes present on its standard input, cpipe executes the provided command. The "-" argument is appended to the command's arguments, so the command executed is: cat alive.txt - cpipe forwards its standard input to the command, so in the above example, cat concatenates the file alive.txt with its standard input, resulting in the above output. But the pipe: cat /dev/null | cpipe cat alive.txt results in no output, since the cat /dev/null pipes no bytes to cpipe's standard input.