Commit c79f0d77 authored by Kenton Varda's avatar Kenton Varda

Merge pull request #190 from dwrensha/capnpc-bin-cat

Hardcode /bin/cat output option for `capnp compile`.
parents ee7c1b0c 33af12c0
...@@ -242,10 +242,11 @@ public: ...@@ -242,10 +242,11 @@ public:
builder.addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, addOutput), "<lang>[:<dir>]", builder.addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, addOutput), "<lang>[:<dir>]",
"Generate source code for language <lang> in directory <dir> " "Generate source code for language <lang> in directory <dir> "
"(default: current directory). <lang> actually specifies a plugin " "(default: current directory). <lang> actually specifies a plugin "
"to use. If <lang> is a simple word, the compiler for a plugin " "to use. If <lang> is a simple word, the compiler searches for a plugin "
"called 'capnpc-<lang>' in $PATH. If <lang> is a file path " "called 'capnpc-<lang>' in $PATH. If <lang> is a file path "
"containing slashes, it is interpreted as the exact plugin " "containing slashes, it is interpreted as the exact plugin "
"executable file name, and $PATH is not searched.") "executable file name, and $PATH is not searched. If <lang> is '-', "
"the compiler dumps the request to standard output.")
.addOptionWithArg({"src-prefix"}, KJ_BIND_METHOD(*this, addSourcePrefix), "<prefix>", .addOptionWithArg({"src-prefix"}, KJ_BIND_METHOD(*this, addSourcePrefix), "<prefix>",
"If a file specified for compilation starts with <prefix>, remove " "If a file specified for compilation starts with <prefix>, remove "
"the prefix for the purpose of deciding the names of output files. " "the prefix for the purpose of deciding the names of output files. "
...@@ -440,6 +441,11 @@ public: ...@@ -440,6 +441,11 @@ public:
} }
for (auto& output: outputs) { for (auto& output: outputs) {
if (kj::str(output.name) == "-") {
writeMessageToFd(STDOUT_FILENO, message);
continue;
}
int pipeFds[2]; int pipeFds[2];
KJ_SYSCALL(pipe(pipeFds)); KJ_SYSCALL(pipe(pipeFds));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment