@oclif/core 4.4.1 → 4.5.1
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 +1 -1
- package/lib/interfaces/hooks.d.ts +2 -0
- package/lib/main.js +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/main.js
CHANGED
|
@@ -59,13 +59,13 @@ async function run(argv, options) {
|
|
|
59
59
|
argv = [symbols_1.SINGLE_COMMAND_CLI_SYMBOL, ...argv];
|
|
60
60
|
}
|
|
61
61
|
const [id, ...argvSlice] = (0, help_1.normalizeArgv)(config, argv);
|
|
62
|
-
const runFinally = async () => {
|
|
62
|
+
const runFinally = async (cmd, error) => {
|
|
63
63
|
marker?.stop();
|
|
64
64
|
if (!initMarker?.stopped)
|
|
65
65
|
initMarker?.stop();
|
|
66
66
|
await performance_1.Performance.collect();
|
|
67
67
|
performance_1.Performance.debug();
|
|
68
|
-
await config.runHook('finally', { argv: argvSlice, id });
|
|
68
|
+
await config.runHook('finally', { argv: argvSlice, Command: cmd, error, id });
|
|
69
69
|
};
|
|
70
70
|
// run init hook
|
|
71
71
|
await config.runHook('init', { argv: argvSlice, id });
|
|
@@ -92,10 +92,15 @@ async function run(argv, options) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
initMarker?.stop();
|
|
95
|
+
let err;
|
|
95
96
|
try {
|
|
96
97
|
return await config.runCommand(id, argvSlice, cmd);
|
|
97
98
|
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
err = error;
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
98
103
|
finally {
|
|
99
|
-
await runFinally();
|
|
104
|
+
await runFinally(cmd, err);
|
|
100
105
|
}
|
|
101
106
|
}
|