prevent segmentation fault error by directly communicating with process

This commit is contained in:
Philipp Kunz 2016-09-18 23:11:26 +02:00
parent 6d61043379
commit 5486e268ed
7 changed files with 52 additions and 49 deletions

View File

@ -1 +1 @@
import "typings-global";
import 'typings-global';

16
dist/early.child.js vendored
View File

@ -10,8 +10,8 @@ let moduleName;
let loaderLength;
let frameCounter = 0;
let makeFrame = () => {
let resultString = `[${chalk.green("/".repeat(frameCounter))}${" ".repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
if (frameCounter == loaderLength) {
let resultString = `[${chalk.green('/'.repeat(frameCounter))}${' '.repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
if (frameCounter === loaderLength) {
frameCounter = 0;
}
else {
@ -28,16 +28,18 @@ let logEarly = () => {
logEarly();
}, 80);
}
else {
readline.clearLine(process.stdout, 0);
process.exit(0);
}
};
let start = function (moduleNameArg = "", loaderLengthArg = "10") {
let start = function (moduleNameArg = '', loaderLengthArg = '10') {
moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg);
logEarly();
};
start(process.env.moduleNameArg, process.env.loaderLengthArg);
process.on('SIGINT', () => {
logEarlyAbort = true;
rl.write(null, { ctrl: true, name: 'u' });
process.exit(0);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWFybHkuY2hpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9lYXJseS5jaGlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLE1BQU8sS0FBSyxXQUFXLE9BQU8sQ0FBQyxDQUFDO0FBQ2hDLE1BQU8sUUFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQ3RDLElBQUksRUFBRSxHQUFHLFFBQVEsQ0FBQyxlQUFlLENBQUM7SUFDOUIsS0FBSyxFQUFFLE9BQU8sQ0FBQyxLQUFLO0lBQ3BC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FJLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDbkIsQ0FBQztBQUNMLENBQUMsQ0FBQTtBQUVELElBQUksS0FBSyxHQUFHLFVBQVUsYUFBYSxHQUFXLEVBQUUsRUFBRSxlQUFlLEdBQVcsSUFBSTtJQUM1RSxVQUFVLEdBQUcsYUFBYSxDQUFBO0lBQzFCLFlBQVksR0FBRyxRQUFRLENBQUMsZUFBZSxDQUFDLENBQUE7SUFDeEMsUUFBUSxFQUFFLENBQUE7QUFDZCxDQUFDLENBQUE7QUFFRCxPQUFPLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRTtJQUNqQixhQUFhLEdBQUcsSUFBSSxDQUFBO0FBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBRUYsS0FBSyxFQUFFLENBQUEifQ==

12
dist/index.js vendored
View File

@ -1,9 +1,9 @@
"use strict";
require('typings-global');
const path = require('path');
const chalk = require('chalk');
const q = require('q');
const childProcess = require('child_process');
require("typings-global");
const path = require("path");
const chalk = require("chalk");
const q = require("q");
const childProcess = require("child_process");
let earlyChild;
let doAnimation = true;
let doText = false;
@ -50,4 +50,4 @@ exports.stop = () => {
}
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ3ZCLE1BQU8sSUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFBO0FBQzdCLE1BQU8sS0FBSyxXQUFXLE9BQU8sQ0FBQyxDQUFBO0FBQy9CLE1BQU8sQ0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFBO0FBQ3ZCLE1BQU8sWUFBWSxXQUFXLGVBQWUsQ0FBQyxDQUFBO0FBQzlDLElBQUksVUFBVSxDQUFBO0FBRWQsSUFBSS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VyxDQUFDLENBQUMsQ0FBQztRQUNkLFVBQVUsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUE7UUFDekIsVUFBVSxDQUFDLEVBQUUsQ0FBQyxPQUFPLEVBQUU7WUFDbkIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEtBQUssQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLE9BQU8sd0JBQXdCLFdBQVcsQ0FBQyxDQUFBO1lBQ3hGLElBQUksQ0FBQyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUNwQyxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLFVBQVUsT0FBTyx3QkFBd0IsRUFBRSxDQUFDLENBQUE7UUFDaEYsSUFBSSxDQUFDLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFBO0lBQ3BDLENBQUM7SUFDRCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUN2QixDQUFDLENBQUEifQ==

View File

@ -227,7 +227,7 @@
"sources": [
{
"fileName": "ts/early.child.ts",
"line": 34,
"line": 37,
"character": 9
}
]

View File

@ -191,7 +191,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in ts/early.child.ts:34</li>
<li>Defined in ts/early.child.ts:37</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>

View File

@ -1,6 +1,6 @@
"use strict";
require('typings-test');
const early = require('../dist/index');
require("typings-test");
const early = require("../dist/index");
describe('early', function () {
it('.start()', function (done) {
this.timeout(10000);
@ -14,4 +14,4 @@ describe('early', function () {
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXM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O0lBQ0YsRUFBRSxDQUFDLFNBQVMsRUFBQyxVQUFTLElBQUk7UUFDdEIsS0FBSyxDQUFDLElBQUksRUFBRTthQUNQLElBQUksQ0FBQztZQUNGLElBQUksRUFBRSxDQUFBO1FBQ1YsQ0FBQyxDQUFDLENBQUE7SUFDVixDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFBIn0=

View File

@ -1,46 +1,47 @@
import "typings-global";
import chalk = require("chalk");
import readline = require("readline");
import 'typings-global'
import chalk = require('chalk')
import readline = require('readline')
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
})
let moduleName: string;
let loaderLength: number;
let frameCounter: number = 0;
let moduleName: string
let loaderLength: number
let frameCounter: number = 0
let makeFrame = (): string => {
let resultString: string = `[${chalk.green("/".repeat(frameCounter))}${" ".repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
if (frameCounter == loaderLength) {
frameCounter = 0;
let resultString: string = `[${chalk.green('/'.repeat(frameCounter))}${' '.repeat(loaderLength - frameCounter)}] starting ${moduleName}`
if (frameCounter === loaderLength) {
frameCounter = 0
} else {
frameCounter++;
frameCounter++
}
return resultString;
};
return resultString
}
let logEarlyAbort = false;
let logEarlyAbort = false
let logEarly = () => {
if (!logEarlyAbort) {
rl.write(null, { ctrl: true, name: 'u' });
rl.write(makeFrame());
rl.write(null, { ctrl: true, name: 'u' })
rl.write(makeFrame())
setTimeout(function () {
logEarly();
}, 80);
logEarly()
}, 80)
} else {
readline.clearLine(process.stdout,0)
process.exit(0)
}
};
}
let start = function (moduleNameArg: string = "", loaderLengthArg: string = "10") {
moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg);
logEarly();
};
start(process.env.moduleNameArg, process.env.loaderLengthArg);
let start = function (moduleNameArg: string = '', loaderLengthArg: string = '10') {
moduleName = moduleNameArg
loaderLength = parseInt(loaderLengthArg)
logEarly()
}
process.on('SIGINT', () => {
logEarlyAbort = true;
rl.write(null, { ctrl: true, name: 'u' });
process.exit(0);
});
logEarlyAbort = true
})
start()