mirror of
https://github.com/koush/scrypted.git
synced 2026-03-16 07:02:07 +00:00
server: update console logging location to accomodate vscode filters
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import {Worker} from 'worker_threads';
|
||||
import { ChildProcess } from 'child_process';
|
||||
import { DeviceManager, ScryptedNativeId, SystemManager } from '@scrypted/types';
|
||||
import { Console } from 'console';
|
||||
import { once } from 'events';
|
||||
import net, { Server } from 'net';
|
||||
import { PassThrough, Readable } from 'stream';
|
||||
import { listenZero } from '../listen-zero';
|
||||
import { ChildProcessWorker } from './runtime/child-process-worker';
|
||||
|
||||
// deno's createRequire or node console doesn't hook inspect...
|
||||
// so grab teh deno console from globalThis which was set earlier in deno-plugin-remote.js
|
||||
@@ -329,3 +332,12 @@ export async function createConsoleServer(remoteStdout: Readable, remoteStderr:
|
||||
writePort,
|
||||
};
|
||||
}
|
||||
|
||||
export function pipeWorkerConsole(nativeWorker: ChildProcess | Worker) {
|
||||
nativeWorker.stdout.on('data', (data) => {
|
||||
console.log(data.toString());
|
||||
});
|
||||
nativeWorker.stderr.on('data', (data) => {
|
||||
console.error(data.toString());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { evalLocal } from '../rpc-peer-eval';
|
||||
import { createDuplexRpcPeer } from '../rpc-serializer';
|
||||
import { MediaManagerImpl } from './media';
|
||||
import { PluginAPI, PluginAPIProxy, PluginRemote, PluginRemoteLoadZipOptions } from './plugin-api';
|
||||
import { prepareConsoles } from './plugin-console';
|
||||
import { pipeWorkerConsole, prepareConsoles } from './plugin-console';
|
||||
import { getPluginNodePath, installOptionalDependencies } from './plugin-npm-dependencies';
|
||||
import { DeviceManagerImpl, attachPluginRemote, setupPluginRemote } from './plugin-remote';
|
||||
import { PluginStats, startStatsUpdater } from './plugin-remote-stats';
|
||||
@@ -375,15 +375,10 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe
|
||||
zipHash,
|
||||
}, undefined);
|
||||
|
||||
if (runtimeWorker instanceof ChildProcessWorker)
|
||||
if (runtimeWorker instanceof ChildProcessWorker) {
|
||||
nativeWorker = runtimeWorker.childProcess;
|
||||
|
||||
nativeWorker.stdout.on('data', (data) => {
|
||||
console.log(data.toString());
|
||||
});
|
||||
nativeWorker.stderr.on('data', (data) => {
|
||||
console.error(data.toString());
|
||||
});
|
||||
pipeWorkerConsole(nativeWorker);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const ntw = new NodeThreadWorker(mainFilename, pluginId, {
|
||||
|
||||
Reference in New Issue
Block a user