@touchtechclub/simbox 0.2.4 → 0.2.5
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/cli.js +8 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -178,6 +178,7 @@ async function currentRun() {
|
|
|
178
178
|
var stopRun = (runId) => api(`/v1/runs/${encodeURIComponent(runId)}/stop`, {
|
|
179
179
|
method: "POST"
|
|
180
180
|
});
|
|
181
|
+
var runHistory = async () => (await api("/v1/runs")).runs;
|
|
181
182
|
function friendlyError(err) {
|
|
182
183
|
if (err instanceof CliError)
|
|
183
184
|
return err;
|
|
@@ -566,8 +567,14 @@ async function cmdSim(opts) {
|
|
|
566
567
|
while (Date.now() < deadline) {
|
|
567
568
|
await sleep(SIM_POLL_MS);
|
|
568
569
|
const run = await currentRun();
|
|
569
|
-
if (!run)
|
|
570
|
+
if (!run) {
|
|
571
|
+
const ended = (await runHistory()).find((candidate) => candidate.id === first.runId);
|
|
572
|
+
if (ended && (ended.state === "ended" || ended.state === "failed")) {
|
|
573
|
+
spinner.fail(`Run ${ended.state}`);
|
|
574
|
+
throw new CliError(`The run ${ended.state} during startup (${ended.endReason ?? "check the Actions logs"}). Try \`simbox sim --new\`.`);
|
|
575
|
+
}
|
|
570
576
|
continue;
|
|
577
|
+
}
|
|
571
578
|
if (run.state === "live" && run.tunnelUrl && run.daemonToken) {
|
|
572
579
|
live = { run, tunnelUrl: run.tunnelUrl, daemonToken: run.daemonToken };
|
|
573
580
|
break;
|