summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 03:04:42 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit80ed1bf997117a36b9d0e10744de736e84d96e7f (patch)
tree9ad644b3d1abf076959ed4b6aad7bc1622e30828 /src/exec.zig
parentbeea3aaa8d35c00145c78a746393d71b8b14e658 (diff)
downloadpardes-80ed1bf997117a36b9d0e10744de736e84d96e7f.tar.gz
pardes-80ed1bf997117a36b9d0e10744de736e84d96e7f.zip
Shell refuses a name that is no executable, and bare restores the default
Shell took any word and the host quietly ran another shell at the next spawn. It now refuses a path or name that is not executable ("Shell: x: no executable by that name", failing a ctl write, logged err), a bare Shell goes back to the default, and a default $SHELL that is not executable falls back to /bin/sh. shellset's golden takes the refusal on the message row (re-recorded by name). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 6de7991c..0a7e71f9 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -761,6 +761,24 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]
if (!p.settings.requestFont(matches[0].path, matches[0].name, spec.size_hundredths)) return;
p.font_request_taken = false;
},
+ // A shell that is no executable is refused, not taken and quietly
+ // replaced at the next spawn; bare, it goes back to the default.
+ .shell => {
+ const want = std.mem.trim(u8, arg orelse "", " \t\r\n");
+ if (want.len == 0) {
+ p.settings.shell.requested.clear();
+ p.settings.shell.pending = true;
+ return;
+ }
+ if (comptime pardes.hosted) {
+ var buf: [std.fs.max_path_bytes]u8 = undefined;
+ if (@import("host_io.zig").Shell.find(want, &buf) == null) {
+ var text: [320]u8 = undefined;
+ return p.reportFailure(p.active, std.fmt.bufPrint(&text, "Shell: {s}: no executable by that name", .{want[0..@min(want.len, 255)]}) catch "Shell: no such executable");
+ }
+ }
+ if (!p.settings.apply(setting, want) and p.announce) p.reportFailure(p.active, "Shell: does not take that value");
+ },
else => if (!p.settings.apply(setting, arg) and p.announce) {
var text: [96]u8 = undefined;
const takes = if (setting.action == .toggle) "takes on or off" else "does not take that value";