Skip to content

Commit 1431732

Browse files
committed
Fix stdout/err might be null type errors
1 parent cb4e3bb commit 1431732

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,19 @@ if (!amMainInstance) {
200200
detached: !isWindows // Detach on Linux, so we can cleanly kill as a group
201201
});
202202

203-
server.stdout.pipe(process.stdout);
204-
server.stderr.pipe(process.stderr);
203+
// Both not null because we pass 'pipe' for args 2 & 3 above.
204+
const stdout = server.stdout!;
205+
const stderr = server.stderr!;
205206

206-
server.stdout.on('data', (data) => {
207+
stdout.pipe(process.stdout);
208+
stderr.pipe(process.stderr);
209+
210+
server.stdout!.on('data', (data) => {
207211
Sentry.addBreadcrumb({ category: 'server-stdout', message: data.toString('utf8'), level: <any>'info' });
208212
});
209213

210214
let lastError: string | undefined = undefined;
211-
server.stderr.on('data', (data) => {
215+
stderr.on('data', (data) => {
212216
const errorOutput = data.toString('utf8');
213217
Sentry.addBreadcrumb({ category: 'server-stderr', message: errorOutput, level: <any>'warning' });
214218

0 commit comments

Comments
 (0)