add forkOptions
This commit is contained in:
parent
9d33a5df53
commit
241880f2b0
3
dist/smartipc.classes.threadsimple.d.ts
vendored
3
dist/smartipc.classes.threadsimple.d.ts
vendored
@ -2,6 +2,7 @@ import * as childProcess from 'child_process';
|
||||
export declare class ThreadSimple {
|
||||
workerPath: string;
|
||||
threadChildProcess: childProcess.ChildProcess;
|
||||
constructor(filePathArg: string);
|
||||
forkOptions: childProcess.ForkOptions;
|
||||
constructor(filePathArg: string, forkOptionsArg?: childProcess.ForkOptions);
|
||||
run(): Promise<childProcess.ChildProcess>;
|
||||
}
|
||||
|
7
dist/smartipc.classes.threadsimple.js
vendored
7
dist/smartipc.classes.threadsimple.js
vendored
@ -5,8 +5,9 @@ const smartq = require("smartq");
|
||||
const childProcess = require("child_process");
|
||||
const smartipc_classes_thread_1 = require("./smartipc.classes.thread");
|
||||
class ThreadSimple {
|
||||
constructor(filePathArg) {
|
||||
constructor(filePathArg, forkOptionsArg = {}) {
|
||||
this.workerPath = filePathArg;
|
||||
this.forkOptions = forkOptionsArg;
|
||||
}
|
||||
run() {
|
||||
let done = smartq.defer();
|
||||
@ -18,10 +19,10 @@ class ThreadSimple {
|
||||
return this.workerPath;
|
||||
}
|
||||
})();
|
||||
this.threadChildProcess = childProcess.fork(forkPath);
|
||||
this.threadChildProcess = childProcess.fork(forkPath, [], this.forkOptions);
|
||||
done.resolve(this.threadChildProcess);
|
||||
return done.promise;
|
||||
}
|
||||
}
|
||||
exports.ThreadSimple = ThreadSimple;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMuY2xhc3Nlcy50aHJlYWRzaW1wbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGlwYy5jbGFzc2VzLnRocmVhZHNpbXBsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDhDQUE2QztBQUM3QyxpQ0FBZ0M7QUFDaEMsOENBQ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wRDtBQUUxRDtJQUlFLFlBQWEsV0FBbUIsRUFBRSxpQkFBMkMsRUFBRTtRQUM3RSxJQUFJLENBQUMsVUFBVSxHQUFHLFdBQVcsQ0FBQTtRQUM3QixJQUFJLENBQUMsV0FBVyxHQUFHLGNBQWMsQ0FBQTtJQUNuQyxDQUFDO0lBRUQsR0FBRztRQUNELElBQUksSUFBSSxHQUFHLE1BQU0sQ0FBQyxLQUFLLEVBQTZCLENBQUE7UUFDcEQsSUFBSSxRQUFRLEdBQUcsQ0FBQztZQUNkLEVBQUUsQ0FBQyxDQUFDLHdDQUFjLENBQUMsQ0FBQyxDQUFDO2dCQUNuQixNQUFNLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsd0NBQWMsRUFBRSxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUE7WUFDM0QsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLE1BQU0sQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFBO1lBQ3hCLENBQUM7UUFDSCxDQUFDLENBQUMsRUFBRSxDQUFBO1FBQ0osSUFBSSxDQUFDLGtCQUFrQixHQUFHLFlBQVksQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsRUFBRSxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7UUFDM0UsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUNyQyxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUNyQixDQUFDO0NBQ0Y7QUF0QkQsb0NBc0JDIn0=
|
@ -7,8 +7,10 @@ import { workerBasePath } from './smartipc.classes.thread'
|
||||
export class ThreadSimple {
|
||||
workerPath: string
|
||||
threadChildProcess: childProcess.ChildProcess
|
||||
constructor (filePathArg: string) {
|
||||
forkOptions: childProcess.ForkOptions
|
||||
constructor (filePathArg: string, forkOptionsArg: childProcess.ForkOptions = {}) {
|
||||
this.workerPath = filePathArg
|
||||
this.forkOptions = forkOptionsArg
|
||||
}
|
||||
|
||||
run () {
|
||||
@ -20,7 +22,7 @@ export class ThreadSimple {
|
||||
return this.workerPath
|
||||
}
|
||||
})()
|
||||
this.threadChildProcess = childProcess.fork(forkPath)
|
||||
this.threadChildProcess = childProcess.fork(forkPath, [], this.forkOptions)
|
||||
done.resolve(this.threadChildProcess)
|
||||
return done.promise
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user