Skip to content

Commit 8475a5c

Browse files
committed
Log stderr also before launch
1 parent fc8acfc commit 8475a5c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

js/demo.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,20 @@ interface NodePrediction {
5454
// Wait for Python inference to start.
5555
log.verbose('waiting for Python');
5656
await new Promise<void>((resolve, reject) => {
57+
let loaded = false;
5758
const messageListener = (data: string) => {
5859
console.log(`PYTHON: ${data}`);
5960
log.silly('python stdout', { data });
6061
if (data === 'Inference started.') {
62+
loaded = true;
6163
python.off('message', messageListener);
6264
resolve();
6365
}
6466
};
6567
python.on('message', messageListener);
6668
python.on('stderr', (data) => {
67-
if (log.isLevelEnabled('debug')) console.error(`PYTERR: ${data}`);
69+
if (!loaded || log.isLevelEnabled('debug'))
70+
console.error(`PYTERR: ${data}`);
6871
log.silly('python stderr', { data });
6972
});
7073
python.on('close', () => {

0 commit comments

Comments
 (0)