Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 7633428

Browse files
authored
Merge pull request #227 from netlify/raees/terminal-clear-fix
Don't allow child scripts to manipulate terminal
2 parents 3de0ea2 + 24908b9 commit 7633428

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/commands/dev/index.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,14 @@ function startDevServer(settings, log) {
158158
const args =
159159
settings.command === "npm" ? ["run", ...settings.args] : settings.args;
160160
const ps = execa(settings.command, args, {
161-
env: settings.env,
162-
stdio: "inherit"
161+
env: { ...settings.env, FORCE_COLOR: "true" },
162+
stdio: ["inherit", "pipe", "pipe"]
163+
});
164+
ps.stdout.on("data", function(buffer) {
165+
process.stdout.write(buffer.toString("utf8"));
166+
});
167+
ps.stderr.on("data", function(buffer) {
168+
process.stderr.write(buffer.toString("utf8"));
163169
});
164170
ps.on("close", code => process.exit(code));
165171
ps.on("SIGINT", process.exit);
@@ -318,7 +324,8 @@ DevCommand.flags = {
318324
}),
319325
port: flags.integer({
320326
char: "p",
321-
description: "port of netlify dev" }),
327+
description: "port of netlify dev"
328+
}),
322329
dir: flags.string({
323330
char: "d",
324331
description: "dir with static files"

0 commit comments

Comments
 (0)