mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-26 06:46:45 -04:00
Obtain footclient working directory when spawning child process
This commit is contained in:
parent
4f3f614457
commit
dd55bc06c0
1 changed files with 12 additions and 1 deletions
13
terminal.c
13
terminal.c
|
|
@ -8,6 +8,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
@ -3298,8 +3299,18 @@ term_bell(struct terminal *term)
|
||||||
bool
|
bool
|
||||||
term_spawn_new(const struct terminal *term)
|
term_spawn_new(const struct terminal *term)
|
||||||
{
|
{
|
||||||
|
/* Get working directory of footclient instead of server
|
||||||
|
* by reading the cwd symbolic link in /proc/<SlavePID>/cwd
|
||||||
|
*/
|
||||||
|
|
||||||
|
char cwd_link[PATH_MAX];
|
||||||
|
char cwd[PATH_MAX];
|
||||||
|
|
||||||
|
snprintf(cwd_link, PATH_MAX, "/proc/%d/cwd", term->slave);
|
||||||
|
readlink(cwd_link, cwd, PATH_MAX);
|
||||||
|
|
||||||
return spawn(
|
return spawn(
|
||||||
term->reaper, term->cwd, (char *const []){term->foot_exe, NULL},
|
term->reaper, cwd, (char *const []){term->foot_exe, NULL},
|
||||||
-1, -1, -1, NULL);
|
-1, -1, -1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue