Skip to content

Commit

Permalink
fix(scully): WATCHMODE: fix problem when use CTRL+C (#388)
Browse files Browse the repository at this point in the history
* fix(scully): wATCHMODE: fix problem when use CTRL+C

* chore(scully): wATCHMODE: remove old code
  • Loading branch information
jorgeucano authored Mar 18, 2020
1 parent 0b7fff6 commit 4dfc751
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions scully/watchMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ export async function bootServe(scullyConfig: ScullyConfig) {
const port = cliOptions.path || scullyConfig.staticport;
console.log('starting static server');
process.title = 'ScullyServer';
// checkChangeAngular(cliOptions.path);
// if (scullyConfig.homeFolder !== cliOptions.folder) {
// closeExpress();
// await httpGetJson(
// `http${cliOptions.ssl ? 's' : ''}://${scullyConfig.hostName}:${scullyConfig.appPort}/killMe`,
// {
// suppressErrors: true,
// }
// );
// }
// restartStaticServer();
startStaticServer();
}

Expand All @@ -45,6 +34,20 @@ export function checkForManualRestart() {
output: process.stdout,
});

// @ts-ignore
readline.addListener('close', async () => {
log(`${yellow('------------------------------------------------------------')}`);
log(`Killing Scully by ${green('ctrl+c')}.`);
log(`${yellow('------------------------------------------------------------')}`);
await httpGetJson(`http://${scullyConfig.hostName}:${scullyConfig.appPort}/killMe`, {
suppressErrors: true,
}).catch(e => e);
await httpGetJson(`https://${scullyConfig.hostName}:${scullyConfig.appPort}/killMe`, {
suppressErrors: true,
}).catch(e => e);
process.exit(0);
});

readline.question(``, async command => {
if (command.toLowerCase() === 'r') {
startScully().then(() => {
Expand Down

0 comments on commit 4dfc751

Please sign in to comment.