Currently commands seems to not keep new lines in string literals, the workaround is to use quotes inside, is this by design ?
import { $ } from "./mod.ts";
await $`echo hello
world`; // the new line here becomes a space
console.log("------------------------------");
await $`echo "hello\nworld"`;
result
hello world
------------------------------
hello
world
Yeah, that's by design. The first command is passing two arguments (["hello", "world"]) and the second is passing one (["hello\world"]). I think it's similar to how echo hello world outputs hello world.
Currently commands seems to not keep new lines in string literals, the workaround is to use quotes inside, is this by design ?
result