Closed
Description
- Version: v12.13.1
- Platform: Linux iZuf6j0kkp9l5d4w5xlukvZ 4.4.0-98-generic ability to serve both HTTP and HTTPS on the same port node#121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: child_process
What steps will reproduce the bug?
test.js
#!/usr/bin/env node
let spawn = require("child_process").spawn;
function showContent(content) {
spawn(`cat <<< "${content}" | less -r`, {
stdio: "inherit", // use the current shell for stdio
shell: true,
});
}
showContent("hello");
-rwxr-xr-x test.js
the function is executable. so ./test.js
is ok. while error is produce. error is the following
/bin/sh: 1: Syntax error: redirection unexpected
How often does it reproduce? Is there a required condition?
on my mac OS, it is ok, while in the linux, the error will trigger.
What is the expected behavior?
perform normal
What do you see instead?
Additional information
I dig into the <<<
redirection,The default system shell in Ubuntu is dash, not bash. Dash does not have the <<< redirection operator. that could be the problem. while I don't know how to solve it.
stackoverflow
Metadata
Metadata
Assignees
Labels
No labels