Skip to content

Commit

Permalink
Release 1.0.0-alpha.21.3 🚀
Browse files Browse the repository at this point in the history
- Kill forked processes on exit
  • Loading branch information
Jonathan committed Apr 27, 2018
1 parent fc4a9e0 commit d281b54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onixjs/core",
"version": "1.0.0-alpha.21",
"version": "1.0.0-alpha.21.3",
"description": "An Enterprise Grade NodeJS Platform that implements Industry Standards and Patterns in order to provide Connectivity, Stability, High-Availability and High-Performance.",
"main": "dist/src/index.js",
"scripts": {
Expand Down Expand Up @@ -117,7 +117,7 @@
"TypeScript",
"ES6",
"ES7",
"Entrprise",
"Enterprise",
"Framework",
"Platform",
"SOA",
Expand Down
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class OnixJS {
* @description Current Onix Version.
*/
get version(): string {
return '1.0.0-alpha.21';
return '1.0.0-alpha.21.3';
}
/**
* @property router
Expand Down Expand Up @@ -68,7 +68,14 @@ export class OnixJS {
constructor(public config: OnixConfig = {cwd: process.cwd(), port: 3000}) {
this.config = Object.assign({cwd: process.cwd(), port: 3000}, config);
// Listener for closing process
process.on('exit', () => this.stop());
process.on('exit', async () => {
// Signal child processes to stop their internal processes
await this.stop();
// Kill'em all right now.
Object.keys(this._apps).forEach(reference =>
this._apps[reference].process.kill('SIGHUP'),
);
});
// Log Onix Version
console.info('Loading Onix Server Version: ', this.version);
}
Expand Down Expand Up @@ -412,7 +419,7 @@ export class OnixJS {
// read file from file system
const data = await AsyncReadFile(pathname);
// Set response headers
res.setHeader('Content-type', 'text/html');
res.setHeader('Content-type', 'text/plain');
res.end(data.toString());
} catch (e) {
res.setHeader('Content-type', 'application/json');
Expand Down

0 comments on commit d281b54

Please sign in to comment.