ThreadSimple is now returning a Promise
This commit is contained in:
parent
d73c877815
commit
e1acfd03e6
2
dist/smartipc.classes.threadsimple.d.ts
vendored
2
dist/smartipc.classes.threadsimple.d.ts
vendored
@ -3,5 +3,5 @@ export declare class ThreadSimple {
|
||||
workerPath: string;
|
||||
threadChildProcess: childProcess.ChildProcess;
|
||||
constructor(filePathArg: string);
|
||||
run(): childProcess.ChildProcess;
|
||||
run(): Promise<{}>;
|
||||
}
|
||||
|
7
dist/smartipc.classes.threadsimple.js
vendored
7
dist/smartipc.classes.threadsimple.js
vendored
@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smartipc.plugins");
|
||||
const smartq = require("smartq");
|
||||
const childProcess = require("child_process");
|
||||
const smartipc_classes_thread_1 = require("./smartipc.classes.thread");
|
||||
class ThreadSimple {
|
||||
@ -8,6 +9,7 @@ class ThreadSimple {
|
||||
this.workerPath = filePathArg;
|
||||
}
|
||||
run() {
|
||||
let done = smartq.defer();
|
||||
let forkPath = (() => {
|
||||
if (smartipc_classes_thread_1.workerBasePath) {
|
||||
return plugins.path.join(smartipc_classes_thread_1.workerBasePath, this.workerPath);
|
||||
@ -17,8 +19,9 @@ class ThreadSimple {
|
||||
}
|
||||
})();
|
||||
this.threadChildProcess = childProcess.fork(forkPath);
|
||||
return this.threadChildProcess;
|
||||
done.resolve(this.threadChildProcess);
|
||||
return done.promise;
|
||||
}
|
||||
}
|
||||
exports.ThreadSimple = ThreadSimple;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMuY2xhc3Nlcy50aHJlYWRzaW1wbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGlwYy5jbGFzc2VzLnRocmVhZHNpbXBsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDhDQUE2QztBQUU3Qyw4Q0F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BQUksR0FBRyxNQUFNLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDekIsSUFBSSxRQUFRLEdBQUcsQ0FBQztZQUNkLEVBQUUsQ0FBQyxDQUFDLHdDQUFjLENBQUMsQ0FBQyxDQUFDO2dCQUNuQixNQUFNLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsd0NBQWMsRUFBRSxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUE7WUFDM0QsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLE1BQU0sQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFBO1lBQ3hCLENBQUM7UUFDSCxDQUFDLENBQUMsRUFBRSxDQUFBO1FBQ0osSUFBSSxDQUFDLGtCQUFrQixHQUFHLFlBQVksQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUE7UUFDckQsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUNyQyxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUNyQixDQUFDO0NBQ0Y7QUFwQkQsb0NBb0JDIn0=
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartipc.plugins'
|
||||
import * as q from 'smartq'
|
||||
import * as smartq from 'smartq'
|
||||
import * as childProcess from 'child_process'
|
||||
|
||||
import { workerBasePath } from './smartipc.classes.thread'
|
||||
@ -12,6 +12,7 @@ export class ThreadSimple {
|
||||
}
|
||||
|
||||
run () {
|
||||
let done = smartq.defer()
|
||||
let forkPath = (() => {
|
||||
if (workerBasePath) {
|
||||
return plugins.path.join(workerBasePath, this.workerPath)
|
||||
@ -20,6 +21,7 @@ export class ThreadSimple {
|
||||
}
|
||||
})()
|
||||
this.threadChildProcess = childProcess.fork(forkPath)
|
||||
return this.threadChildProcess
|
||||
done.resolve(this.threadChildProcess)
|
||||
return done.promise
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user