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