aboutsummaryrefslogtreecommitdiffstats
path: root/surfaces
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-30 05:38:45 +0100
committereunhhu <[email protected]>2026-09-30 05:38:45 +0100
commit7705831ebdf94186d1513f3e1b8d7d5ab8b3a2c0 (patch)
tree56d87ab985ab2baa187581a5df8f69ef3c275758 /surfaces
parent461714a01549841746b721d38441df21f74a4077 (diff)
downloadvega-7705831ebdf94186d1513f3e1b8d7d5ab8b3a2c0.tar.gz
vega-7705831ebdf94186d1513f3e1b8d7d5ab8b3a2c0.zip
Say why Pure refused to start or replace the module
pure_app_start and pure_app_replace now say in PureApp.why why they refused, when they can (sends waiting on an output the module lacks). Vega printed only the result's number; it prints the reason beside it.
Diffstat (limited to 'surfaces')
-rw-r--r--surfaces/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/surfaces/main.c b/surfaces/main.c
index 3b5a95a..fc68d97 100644
--- a/surfaces/main.c
+++ b/surfaces/main.c
@@ -121,7 +121,10 @@ static bool load(const char *path, const char *store) {
if (!load_module(path, &modules[current])) return false;
if (store && pure_store_init(store) != PURE_OK) { fprintf(stderr, "vega: cannot open store %s\n", store); return false; }
PureResult started = pure_app_start(&app, &modules[current], store ? pure_tree_data(store) : (PureData){0});
- if (started != PURE_OK) { fprintf(stderr, "vega: cannot start (%d)\n", (int)started); return false; }
+ if (started != PURE_OK) {
+ fprintf(stderr, "vega: cannot start (%d%s%s)\n", (int)started, app.why[0] ? ": " : "", app.why);
+ return false;
+ }
vega_screen(&screen, &modules[current]);
typing = screen.prompt >= 0;
return true;
@@ -135,7 +138,8 @@ static bool swap(const char *path, long size) {
if (!decode(path, size, next)) return false;
PureResult replaced = pure_app_replace(&app, next);
if (replaced != PURE_OK) {
- fprintf(stderr, "vega: keeping the running module: cannot replace it (%d)\n", (int)replaced);
+ fprintf(stderr, "vega: keeping the running module: cannot replace it (%d%s%s)\n", (int)replaced,
+ app.why[0] ? ": " : "", app.why);
return false;
}
bool had_prompt = screen.prompt >= 0;