Skip to content

Commit 937dfee

Browse files
committed
strip ansi from stdout and stderr
1 parent e1ea59c commit 937dfee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/plugins/run-code-blocks/server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ChildProcess, spawn } from 'child_process';
22
import { Option, assert } from 'ts-std';
3+
import { stripVTControlCharacters } from 'node:util';
34

45
const WINDOWS = process.platform === 'win32';
56

@@ -121,7 +122,7 @@ export default class Server {
121122

122123
process.stdout.on('data', chunk => {
123124
assert(this.process === null || this.process === process, `this.process was reassigned`);
124-
this._stdout.push(chunk);
125+
this._stdout.push(stripVTControlCharacters(chunk.toString()));
125126

126127
if (expect && this.status === Status.Starting) {
127128
if (this.stdout!.includes(expect)) {
@@ -132,7 +133,7 @@ export default class Server {
132133

133134
process.stderr.on('data', chunk => {
134135
assert(this.process === null || this.process === process, `this.process was reassigned`);
135-
this._stderr.push(chunk);
136+
this._stderr.push(stripVTControlCharacters(chunk.toString()));
136137
});
137138

138139
process.on('exit', (code, signal) => {

0 commit comments

Comments
 (0)