Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tgrid",
"version": "1.1.0",
"version": "1.2.0",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"exports": {
Expand Down
15 changes: 12 additions & 3 deletions src/protocols/workers/WorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class WorkerConnector<
* memory leak.
*
* @param content JS Source code to compile.
* @param timeout Detailed options like timeout.
* @param options Detailed options like timeout.
*/
public async compile(
content: string,
Expand Down Expand Up @@ -146,8 +146,7 @@ export class WorkerConnector<
* memory leak.
*
* @param jsFile JS File to be {@link WorkerServer}.
* @param args Headers containing initialization data like activation.
* @param timeout Detailed options like timeout.
* @param options Detailed options like timeout.
*/
public async connect(
jsFile: string,
Expand Down Expand Up @@ -352,5 +351,15 @@ export namespace WorkerConnector {
* Available only in the NodeJS + Process environments.
*/
stdio: "overlapped" | "pipe" | "ignore" | "inherit";

/**
* Current working directory of the worker server.
*/
cwd: string;

/**
* Environment variables to be passed to the worker server.
*/
env: Record<string, string>;
}
}
2 changes: 2 additions & 0 deletions src/protocols/workers/internal/processes/ProcessWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export async function ProcessWorker(): Promise<IWorkerCompiler.Creator> {
this.process_ = fork(jsFile, {
execArgv: options?.execArgv,
stdio: options?.stdio,
cwd: options?.cwd,
...(options?.env ? { env: options.env } : {}),
});
}

Expand Down