river: error out if default init is not executable

This commit is contained in:
Leon Henrik Plickat 2022-06-06 21:53:55 +02:00 committed by GitHub
parent a413790158
commit 37da205be0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,6 +140,12 @@ fn defaultInitPath() !?[:0]const u8 {
}; };
os.accessZ(path, os.X_OK) catch |err| { os.accessZ(path, os.X_OK) catch |err| {
if (err == error.PermissionDenied) {
if (os.accessZ(path, os.R_OK)) {
std.log.err("failed to run init executable {s}: the file is not executable", .{path});
os.exit(1);
} else |_| {}
}
std.log.err("failed to run init executable {s}: {s}", .{ path, @errorName(err) }); std.log.err("failed to run init executable {s}: {s}", .{ path, @errorName(err) });
util.gpa.free(path); util.gpa.free(path);
return null; return null;