@phreshos/cli 0.1.35 → 0.1.36
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/dist/launch.js +10 -5
- package/dist/template/package.json +1 -1
- package/package.json +1 -1
package/dist/launch.js
CHANGED
|
@@ -48,7 +48,6 @@ export default async function launch(mode, directory = process.cwd(), options =
|
|
|
48
48
|
await project.build();
|
|
49
49
|
program = await system.forceCreateProgram(definition);
|
|
50
50
|
ended = await consume(program.process.run({ options }, { signal: controller.signal }), client);
|
|
51
|
-
console.log(`\n ${dim("ran as")} ${ended.process}`);
|
|
52
51
|
}
|
|
53
52
|
catch (error) {
|
|
54
53
|
if (!interrupted)
|
|
@@ -56,12 +55,16 @@ export default async function launch(mode, directory = process.cwd(), options =
|
|
|
56
55
|
}
|
|
57
56
|
finally {
|
|
58
57
|
controller.abort(new Error("The local Program run ended"));
|
|
59
|
-
await
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const cleanup = await Promise.allSettled([
|
|
59
|
+
client?.stop(),
|
|
60
|
+
program ? forget(program) : undefined
|
|
61
|
+
]);
|
|
62
62
|
for (const signal of ["SIGINT", "SIGTERM"])
|
|
63
63
|
process.off(signal, stop);
|
|
64
64
|
await system.disconnect();
|
|
65
|
+
const failure = cleanup.find(result => result.status === "rejected");
|
|
66
|
+
if (failure?.status === "rejected")
|
|
67
|
+
throw failure.reason;
|
|
65
68
|
}
|
|
66
69
|
if (interrupted)
|
|
67
70
|
process.exit(130);
|
|
@@ -98,8 +101,10 @@ async function consume(lifecycle, client) {
|
|
|
98
101
|
if (outcome.result.done)
|
|
99
102
|
break;
|
|
100
103
|
const event = outcome.result.value;
|
|
101
|
-
if (event.event === "started")
|
|
104
|
+
if (event.event === "started") {
|
|
102
105
|
process = event.process.identity;
|
|
106
|
+
line("process", process);
|
|
107
|
+
}
|
|
103
108
|
else if (event.event === "output")
|
|
104
109
|
write(event.stream, event.text);
|
|
105
110
|
else
|