From d6090f7488b43346bcdd354d15363e3620375f43 Mon Sep 17 00:00:00 2001 From: Juhani Krekelä Date: Wed, 12 Feb 2025 18:06:20 +0200 Subject: Also look for a compatible procfs in /compat/linux/proc On FreeBSD it is conventional to mount the Linux-style proc filesystem at /compat/linux/proc, if it is required by installed software. Falling back to it, if we can't determine the current working directory using /proc, makes weltschmerz work better out of the box on FreeBSD without regressing Linux. --- terminal.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'terminal.vala') diff --git a/terminal.vala b/terminal.vala index fcb456c..6dfe61e 100644 --- a/terminal.vala +++ b/terminal.vala @@ -419,7 +419,11 @@ class Terminal : Gtk.Overlay { return osc7_path; } - return Posix.realpath("/proc/%i/cwd".printf(child_pid)); + string? path = Posix.realpath("/proc/%i/cwd".printf(child_pid)); + // If we couldn't get the cwd from /proc, try /compat/linux/proc + if (path == null) + path = Posix.realpath("/compat/linux/proc/%i/cwd".printf(child_pid)); + return path; } void spawn_process(string? cwd, string[] argv) { -- cgit v1.2.3-2-gb3c3