Skip to content
Snippets Groups Projects
Commit a119c860 authored by Jason Mulligan's avatar Jason Mulligan
Browse files

Sending a "SIGHUP" to the ps via `kill()`, removing an unneeded invariant

parent c7ed1445
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,7 @@ var Worker = (function () { ...@@ -52,7 +52,7 @@ var Worker = (function () {
}, { }, {
key: "terminate", key: "terminate",
value: function terminate() { value: function terminate() {
this.child.kill(); this.child.kill("SIGHUP");
} }
}]); }]);
......
...@@ -47,8 +47,7 @@ process.once("message", function (obj) { ...@@ -47,8 +47,7 @@ process.once("message", function (obj) {
global.require = require; global.require = require;
global.importScripts = function () { global.importScripts = function () {
var script = undefined, var scripts = undefined;
scripts = undefined;
for (var _len = arguments.length, files = Array(_len), _key = 0; _key < _len; _key++) { for (var _len = arguments.length, files = Array(_len), _key = 0; _key < _len; _key++) {
files[_key] = arguments[_key]; files[_key] = arguments[_key];
...@@ -59,8 +58,7 @@ process.once("message", function (obj) { ...@@ -59,8 +58,7 @@ process.once("message", function (obj) {
return fs.readFileSync(file, "utf8"); return fs.readFileSync(file, "utf8");
}).join("\n"); }).join("\n");
script = vm.createScript(scripts); vm.createScript(scripts).runInThisContext();
script.runInThisContext();
} }
}; };
......
{ {
"name": "tiny-worker", "name": "tiny-worker",
"version": "1.1.0", "version": "1.1.1",
"description": "Tiny WebWorker for Server", "description": "Tiny WebWorker for Server",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
......
...@@ -38,7 +38,7 @@ class Worker { ...@@ -38,7 +38,7 @@ class Worker {
} }
terminate () { terminate () {
this.child.kill(); this.child.kill("SIGHUP");
} }
} }
......
...@@ -45,15 +45,14 @@ process.once("message", function (obj) { ...@@ -45,15 +45,14 @@ process.once("message", function (obj) {
global.require = require; global.require = require;
global.importScripts = function (...files) { global.importScripts = function (...files) {
let script, scripts; let scripts;
if (files.length > 0) { if (files.length > 0) {
scripts = files.map(function (file) { scripts = files.map(function (file) {
return fs.readFileSync(file, "utf8"); return fs.readFileSync(file, "utf8");
}).join("\n"); }).join("\n");
script = vm.createScript(scripts); vm.createScript(scripts).runInThisContext();
script.runInThisContext();
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment