@travetto/cli 7.1.1 → 7.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +3 -3
- package/src/execute.ts +4 -1
- package/src/util.ts +5 -6
package/README.md
CHANGED
|
@@ -498,7 +498,8 @@ export class WebHttpCommand implements CliCommandShape {
|
|
|
498
498
|
const result = this.killConflict ? await NetUtil.freePortOnConflict(err) : undefined;
|
|
499
499
|
if (result?.processId) {
|
|
500
500
|
console.warn('Killed process owning port', result);
|
|
501
|
-
process.
|
|
501
|
+
process.exitCode = 1; // Indicate error, restart will use if in that mode
|
|
502
|
+
return;
|
|
502
503
|
}
|
|
503
504
|
throw err;
|
|
504
505
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/cli",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI infrastructure for Travetto framework",
|
|
6
6
|
"keywords": [
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"directory": "module/cli"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/schema": "^7.1.
|
|
33
|
-
"@travetto/terminal": "^7.1.
|
|
32
|
+
"@travetto/schema": "^7.1.2",
|
|
33
|
+
"@travetto/terminal": "^7.1.2"
|
|
34
34
|
},
|
|
35
35
|
"travetto": {
|
|
36
36
|
"displayName": "Command Line Interface",
|
package/src/execute.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConsoleManager, Runtime, ShutdownManager } from '@travetto/runtime';
|
|
1
|
+
import { ConsoleManager, Runtime, ShutdownManager, Util } from '@travetto/runtime';
|
|
2
2
|
|
|
3
3
|
import { HelpUtil } from './help.ts';
|
|
4
4
|
import { CliCommandRegistryIndex } from './registry/registry-index.ts';
|
|
@@ -63,6 +63,9 @@ export class ExecutionManager {
|
|
|
63
63
|
*/
|
|
64
64
|
static async run(argv: string[]): Promise<void> {
|
|
65
65
|
try {
|
|
66
|
+
// Wait 50ms to allow stdout to flush on shutdown
|
|
67
|
+
ShutdownManager.signal.addEventListener('abort', () => Util.blockingTimeout(50));
|
|
68
|
+
|
|
66
69
|
const { cmd, args, help } = CliParseUtil.getArgs(argv);
|
|
67
70
|
if (!cmd) {
|
|
68
71
|
console.info!(await HelpUtil.renderAllHelp());
|
package/src/util.ts
CHANGED
|
@@ -31,7 +31,7 @@ export class CliUtil {
|
|
|
31
31
|
static async runWithRestartOnChange<T extends CliCommandShapeFields>(cmd: T): Promise<void> {
|
|
32
32
|
if (Env.TRV_RESTART_TARGET.isTrue) {
|
|
33
33
|
Env.TRV_RESTART_TARGET.clear();
|
|
34
|
-
|
|
34
|
+
ShutdownManager.disableInterrupt();
|
|
35
35
|
return;
|
|
36
36
|
} else if (cmd.restartOnChange !== true) {
|
|
37
37
|
return; // Not restarting, run normal
|
|
@@ -40,8 +40,8 @@ export class CliUtil {
|
|
|
40
40
|
ShutdownManager.disableInterrupt();
|
|
41
41
|
|
|
42
42
|
let child: ChildProcess | undefined;
|
|
43
|
-
void WatchUtil.watchCompilerEvents('file', () => child
|
|
44
|
-
process.on('SIGINT', () => child
|
|
43
|
+
void WatchUtil.watchCompilerEvents('file', () => ShutdownManager.shutdownChild(child!, { signal: 'SIGTERM', reason: 'restart', exit: true }));
|
|
44
|
+
process.on('SIGINT', () => ShutdownManager.shutdownChild(child!, { signal: 'SIGTERM', reason: 'quit', exit: true }));
|
|
45
45
|
|
|
46
46
|
const env = { ...process.env, ...Env.TRV_RESTART_TARGET.export(true) };
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ export class CliUtil {
|
|
|
49
49
|
async () => {
|
|
50
50
|
child = spawn(process.argv0, process.argv.slice(1), { env, stdio: ['pipe', 1, 2, 'ipc'] });
|
|
51
51
|
const { code } = await ExecUtil.deferToSubprocess(child);
|
|
52
|
-
return
|
|
52
|
+
return ShutdownManager.reasonForExitCode(code);
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
maxRetries: 5,
|
|
@@ -64,8 +64,7 @@ export class CliUtil {
|
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
await ShutdownManager.shutdown();
|
|
68
|
-
process.exit();
|
|
67
|
+
await ShutdownManager.shutdown({ reason: 'quit', exit: true });
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
/**
|