mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-25 01:40:19 -05:00
term: term_init: add 'cwd' argument
This is used when spawning the slave, to set its current working directory just before we exec() the client. In a regular foot instance, we set the cwd from getcwd(). In a foot server instance, each connecting client sends its cwd to the server, and we use that.
This commit is contained in:
parent
277735db65
commit
39146fac5c
6 changed files with 28 additions and 18 deletions
4
slave.c
4
slave.c
|
|
@ -69,7 +69,7 @@ err:
|
|||
}
|
||||
|
||||
pid_t
|
||||
slave_spawn(int ptmx, int argc, char *const *argv,
|
||||
slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
||||
const char *term_env, const char *conf_shell)
|
||||
{
|
||||
int fork_pipe[2];
|
||||
|
|
@ -90,6 +90,8 @@ slave_spawn(int ptmx, int argc, char *const *argv,
|
|||
/* Child */
|
||||
close(fork_pipe[0]); /* Close read end */
|
||||
|
||||
chdir(cwd);
|
||||
|
||||
/* Restore signals */
|
||||
const struct sigaction sa = {.sa_handler = SIG_DFL};
|
||||
if (sigaction(SIGINT, &sa, NULL) < 0 ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue