-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec.ts
31 lines (26 loc) · 792 Bytes
/
exec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { AppConfig } from './config/app.config';
import Log from 'vendor/astro/util/Logger';
import { serve } from 'vendor/astro/server/serve';
import { existsSync } from 'fs';
import { EnvSpawner } from 'vendor/astro/services/envSpawner';
if (!existsSync(__dirname.replace(new RegExp(/\\/, 'g'), '/') + '/.env')) {
Log('Environment not found. Please rename .env.example to .env', 'error');
process.exit();
}
EnvSpawner.spawn();
process.on('SIGINT', () => {
serve.halt();
});
const rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', (chunk: string) => {
switch (chunk) {
// an elegant way to stop the process
case "stop":
serve.halt();
break;
}
});