-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
@wyattscarpenter
Description
I'm contributing to another project that uses pbts. When I run yarn run --silent pbts proto.js
from my project directory ~/j"oker `something` 'cool streamlit;
that I made to test resiliency to special characters, I get this output:
Error: Command failed: yarn run --silent pbts proto.js
/bin/sh: 1: Syntax error: Unterminated quoted string
/home/user/j"oker `something` 'cool streamlit;/frontend/node_modules/protobufjs-cli/pbts.js:129
throw err;
^
Error: code 2
at ChildProcess.<anonymous> (/home/user/j"oker `something` 'cool streamlit;/frontend/node_modules/protobufjs-cli/pbts.js:126:27)
at ChildProcess.emit (node:events:519:35)
at maybeClose (node:internal/child_process:1101:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:507:28)
at Pipe.<anonymous> (node:net:346:12)
Node.js v24.2.0
Failed to generate protobuf files: Error: Command failed: yarn run --silent pbts proto.js
/bin/sh: 1: Syntax error: Unterminated quoted string
/home/user/j"oker `something` 'cool streamlit;/frontend/node_modules/protobufjs-cli/pbts.js:129
throw err;
^
Error: code 2
at ChildProcess.<anonymous> (/home/user/j"oker `something` 'cool streamlit;/frontend/node_modules/protobufjs-cli/pbts.js:126:27)
at ChildProcess.emit (node:events:519:35)
at maybeClose (node:internal/child_process:1101:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:507:28)
at Pipe.<anonymous> (node:net:346:12)
Node.js v24.2.0
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at ChildProcess.exithandler (node:child_process:415:12)
at ChildProcess.emit (node:events:507:28)
at maybeClose (node:internal/child_process:1101:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
code: 1,
killed: false,
signal: null,
cmd: 'yarn run --silent pbts proto.js'
}
make: *** [Makefile:237: protobuf] Error 1
I'm happy to tell you I know exactly why this happens, after just a little sleuthing:
Line 97 in f42297b
// There is no proper API for jsdoc, so this executes the CLI and pipes the output
Specifically, this call to exec does not escape its arguments (note that escaping arguments is generally a pretty brittle and annoying way of dealing with such problems...), so they evaluate in the shell and cause a parse error:
function callJsdoc() {
// There is no proper API for jsdoc, so this executes the CLI and pipes the output
var basedir = path.join(__dirname, ".");
var moduleName = argv.name || "null";
var nodePath = process.execPath;
var cmd = "\"" + nodePath + "\" \"" + require.resolve("jsdoc/jsdoc.js") + "\" -c \"" + path.join(basedir, "lib", "tsd-jsdoc.json") + "\" -q \"module=" + encodeURIComponent(moduleName) + "&comments=" + Boolean(argv.comments) + "\" " + files.map(function(file) { return "\"" + file + "\""; }).join(" ");
var child = child_process.exec(cmd, {
cwd: process.cwd(),
argv0: "node",
stdio: "pipe",
maxBuffer: 1 << 26 // 67mb
});
Incidentally, we also use yarn run --silent pbjs
, and that has no problem.
Metadata
Metadata
Assignees
Labels
No labels