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

Commit e48711b

Browse files
committed
Strip ANSI before displaying child output
1 parent 92eba60 commit e48711b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"resolve": "^1.10.0",
4040
"safe-join": "^0.1.2",
4141
"static-server": "^2.2.1",
42+
"strip-ansi": "^5.2.0",
4243
"wait-port": "^0.2.2",
4344
"wrap-ansi": "^5.1.0"
4445
},

src/commands/dev/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const httpProxy = require("http-proxy");
55
const waitPort = require("wait-port");
66
const getPort = require("get-port");
77
const chokidar = require("chokidar");
8+
const stripAnsi = require("strip-ansi")
89
const { serveFunctions } = require("../../utils/serve-functions");
910
const { serverSettings } = require("../../detect-server");
1011
const { detectFunctionsBuilder } = require("../../detect-functions-builder");
@@ -160,6 +161,12 @@ function startDevServer(settings, log) {
160161
const ps = execa(settings.command, args, {
161162
env: settings.env,
162163
});
164+
ps.stdout.on('data', function(buffer) {
165+
process.stdout.write(stripAnsi(buffer.toString('utf8')))
166+
})
167+
ps.stderr.on('data', function(buffer) {
168+
process.stderr.write(stripAnsi(buffer.toString('utf8')))
169+
})
163170
ps.on("close", code => process.exit(code));
164171
ps.on("SIGINT", process.exit);
165172
ps.on("SIGTERM", process.exit);

0 commit comments

Comments
 (0)