Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
e0dffad3f2 | |||
241880f2b0 | |||
9d33a5df53 | |||
57ddf4c45d |
5
dist/smartipc.classes.threadsimple.d.ts
vendored
5
dist/smartipc.classes.threadsimple.d.ts
vendored
@ -2,6 +2,7 @@ import * as childProcess from 'child_process';
|
|||||||
export declare class ThreadSimple {
|
export declare class ThreadSimple {
|
||||||
workerPath: string;
|
workerPath: string;
|
||||||
threadChildProcess: childProcess.ChildProcess;
|
threadChildProcess: childProcess.ChildProcess;
|
||||||
constructor(filePathArg: string);
|
forkOptions: childProcess.ForkOptions;
|
||||||
run(): Promise<{}>;
|
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 childProcess = require("child_process");
|
||||||
const smartipc_classes_thread_1 = require("./smartipc.classes.thread");
|
const smartipc_classes_thread_1 = require("./smartipc.classes.thread");
|
||||||
class ThreadSimple {
|
class ThreadSimple {
|
||||||
constructor(filePathArg) {
|
constructor(filePathArg, forkOptionsArg = {}) {
|
||||||
this.workerPath = filePathArg;
|
this.workerPath = filePathArg;
|
||||||
|
this.forkOptions = forkOptionsArg;
|
||||||
}
|
}
|
||||||
run() {
|
run() {
|
||||||
let done = smartq.defer();
|
let done = smartq.defer();
|
||||||
@ -18,10 +19,10 @@ class ThreadSimple {
|
|||||||
return this.workerPath;
|
return this.workerPath;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
this.threadChildProcess = childProcess.fork(forkPath);
|
this.threadChildProcess = childProcess.fork(forkPath, [], this.forkOptions);
|
||||||
done.resolve(this.threadChildProcess);
|
done.resolve(this.threadChildProcess);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
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Q0FBQyxJQUFJLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUNyQyxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUNyQixDQUFDO0NBQ0Y7QUF0QkQsb0NBc0JDIn0=
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartipc",
|
"name": "smartipc",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"description": "smart subprocess handling",
|
"description": "smart subprocess handling",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -7,12 +7,14 @@ import { workerBasePath } from './smartipc.classes.thread'
|
|||||||
export class ThreadSimple {
|
export class ThreadSimple {
|
||||||
workerPath: string
|
workerPath: string
|
||||||
threadChildProcess: childProcess.ChildProcess
|
threadChildProcess: childProcess.ChildProcess
|
||||||
constructor (filePathArg: string) {
|
forkOptions: childProcess.ForkOptions
|
||||||
|
constructor (filePathArg: string, forkOptionsArg: childProcess.ForkOptions = {}) {
|
||||||
this.workerPath = filePathArg
|
this.workerPath = filePathArg
|
||||||
|
this.forkOptions = forkOptionsArg
|
||||||
}
|
}
|
||||||
|
|
||||||
run () {
|
run () {
|
||||||
let done = smartq.defer()
|
let done = smartq.defer<childProcess.ChildProcess>()
|
||||||
let forkPath = (() => {
|
let forkPath = (() => {
|
||||||
if (workerBasePath) {
|
if (workerBasePath) {
|
||||||
return plugins.path.join(workerBasePath, this.workerPath)
|
return plugins.path.join(workerBasePath, this.workerPath)
|
||||||
@ -20,7 +22,7 @@ export class ThreadSimple {
|
|||||||
return this.workerPath
|
return this.workerPath
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
this.threadChildProcess = childProcess.fork(forkPath)
|
this.threadChildProcess = childProcess.fork(forkPath, [], this.forkOptions)
|
||||||
done.resolve(this.threadChildProcess)
|
done.resolve(this.threadChildProcess)
|
||||||
return done.promise
|
return done.promise
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user