Skip to content

Commit d386830

Browse files
spawn ignition, not execute
1 parent 0dc7dc0 commit d386830

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

src/index.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,29 @@ async function main() {
173173
term.set_variable("ENV", "web");
174174

175175
// run ignition to set up the terminal, then call loaded() once detached
176-
term.execute("ignition").then((success) => {
177-
// check if lodestar was successfully loaded
178-
if (!success || term.get_variable("?") !== "0") {
179-
term.panic("ignition failed to run!");
176+
try {
177+
const ignition = term.spawn("ignition", []);
178+
179+
if (ignition.process.pid !== 1) {
180+
term.panic("ignition did not start as PID 1!");
181+
return;
180182
}
181183

182-
loaded(term);
183-
});
184+
ignition.completion.then((exit_code) => {
185+
if (exit_code !== 0) {
186+
term.panic("ignition error!", `Exit code: ${exit_code}`);
187+
return;
188+
}
184189

190+
loaded(term);
191+
}).catch((e) => {
192+
boot_screen.remove();
193+
term.panic("ignition error!", e.toString());
194+
});
195+
} catch (e) {
196+
term.panic("Failed to start ignition!", e.toString());
197+
return;
198+
}
185199

186200
// load addons
187201
const fit = new FitAddon();

0 commit comments

Comments
 (0)