scm: clean up scm running

Split run_script / run_repl more clearly; update callers.
This commit is contained in:
Dirk-Jan C. Binnema
2025-08-25 08:31:12 +03:00
committed by Seth Ladygo
parent 5378f321f4
commit 013233c041
4 changed files with 84 additions and 80 deletions

View File

@ -125,12 +125,13 @@ maybe_listen_path(const Mu::Store& store, const Mu::Options& opts)
#ifdef BUILD_SCM
if (!opts.scm.socket_path)
return {};
const auto res = Mu::Scm::run(store, opts, false/*!block*/);
const auto socket_path{*opts.scm.socket_path};
const auto res = Mu::Scm::run_repl(store, opts, socket_path);
if (!res) {
mu_warning("failed to start scm socket: {}", res.error().what());
return {};
} else
return *opts.scm.socket_path;
return socket_path;
#endif /*BUILD_SCM*/
return {};
}

View File

@ -73,7 +73,10 @@ cmd_scm(const Store& store, const Options& opts)
return Err(Error::Code::InvalidArgument,
"scm/guile is not available in this build");
#else
return Mu::Scm::run(store, opts, true/*blocking*/);
if (opts.scm.script_path)
return Mu::Scm::run_script(store, opts, *opts.scm.script_path);
else
return Mu::Scm::run_repl(store, opts, opts.scm.socket_path.value_or(""));
#endif /*BUILD_SCM*/
}