mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
avoid asserting working directory is absolute
`std.fs.accessAbsolute` asserts if the user proposed path is absolute, which we are seemingly passing as-is with no validating that it is. When running with safety checks on, passing non-absolute path to --working-directory will make ghostty crash. I changed it to use `Dir.access`, which is just `accessAbsolute` without the check. This has the side effect of also allowing relative working directory.
This commit is contained in:
@ -1135,7 +1135,7 @@ const Subprocess = struct {
|
|||||||
// This is important because our cwd can be set by the shell (OSC 7)
|
// This is important because our cwd can be set by the shell (OSC 7)
|
||||||
// and we don't want to break new windows.
|
// and we don't want to break new windows.
|
||||||
const cwd: ?[]const u8 = if (self.cwd) |proposed| cwd: {
|
const cwd: ?[]const u8 = if (self.cwd) |proposed| cwd: {
|
||||||
if (std.fs.accessAbsolute(proposed, .{})) {
|
if (std.fs.cwd().access(proposed, .{})) {
|
||||||
break :cwd proposed;
|
break :cwd proposed;
|
||||||
} else |err| {
|
} else |err| {
|
||||||
log.warn("cannot access cwd, ignoring: {}", .{err});
|
log.warn("cannot access cwd, ignoring: {}", .{err});
|
||||||
|
Reference in New Issue
Block a user