diff --git a/deltachat-rpc-server/npm-package/index.d.ts b/deltachat-rpc-server/npm-package/index.d.ts index a3cd2c421..640a65535 100644 --- a/deltachat-rpc-server/npm-package/index.d.ts +++ b/deltachat-rpc-server/npm-package/index.d.ts @@ -20,17 +20,20 @@ export function getRPCServerPath( export type DeltaChatOverJsonRpcServer = StdioDeltaChat & { - shutdown: () => Promise; readonly pathToServerBinary: string; }; +export interface StartOptions { + /** whether to disable outputting stderr to the parent process's stderr */ + muteStdErr: boolean; +} /** * * @param directory directory for accounts folder * @param options */ -export function startDeltaChat(directory: string, options?: Partial ): Promise +export function startDeltaChat(directory: string, options?: Partial ): Promise export namespace FnTypes { diff --git a/deltachat-rpc-server/npm-package/index.js b/deltachat-rpc-server/npm-package/index.js index 35d348f9f..e1dc4db84 100644 --- a/deltachat-rpc-server/npm-package/index.js +++ b/deltachat-rpc-server/npm-package/index.js @@ -130,6 +130,7 @@ export async function startDeltaChat(directory, options) { RUST_LOG: process.env.RUST_LOG || "info", DC_ACCOUNTS_PATH: directory, }, + stdio: ["pipe", "pipe", options.muteStdErr ? "ignore" : "inherit"], }); server.on("error", (err) => { @@ -144,13 +145,11 @@ export async function startDeltaChat(directory, options) { throw new Error("Server quit"); }); - server.stderr.pipe(process.stderr); - /** @type {import('./index').DeltaChatOverJsonRpcServer} */ //@ts-expect-error const dc = new StdioDeltaChat(server.stdin, server.stdout, true); - dc.shutdown = async () => { + dc.close = () => { shouldClose = true; if (!server.kill()) { console.log("server termination failed");