aboutsummaryrefslogtreecommitdiff
path: root/slave.h (follow)
Commit message (Collapse)AuthorAgeLines
* slave: don't skip setting environment variables when using a custom environmentDaniel Eklöf2024-01-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When launching footclient with -E,--client-environment the environment variables that should be set by foot, wasn't. Those variables are: * TERM * COLORTERM * PWD * SHELL and all variables defined by the user in the [environment] section in foot.ini. In the same way, we did not *unset* TERM_PROGRAM and TERM_PROGRAM_VERSION. This patch fixes it by "cloning" the custom environment, making it mutable, and then adding/removing the variables above from it. Instead of calling setenv()/unsetenv() directly, we add the wrapper functions add_to_env() and del_from_env(). When *not* using a custom environment, they simply call setenv()/unsetenv(). When we *are* using a custom environment, add_to_env() first loops all existing variables, looking for a match. If a match is found, it's updated with the new value. If it's not found, a new entry is added. del_from_env() loops all entries, and removes it when a match is found. If no match is found, nothing is done. The mutable environment is allocated on the heap, but never free:d. We don't need to free it, since it's only allocated after forking, in the child process. Closes #1568
* config: add a new ‘environment’ sectionDaniel Eklöf2022-06-13-1/+3
| | | | | | | | This section allows the user to define custom environment variables to be set in the child process: [environment] name=value
* client: add -E,--client-environmentDaniel Eklöf2022-04-12-2/+2
| | | | | | | | | | | | | | | | | When this option is used, the child process in the new terminal instance will inherit its environment from the footclient process, instead of the foot server’s. Implemented by sending (yet another) dynamic string list as part of the client -> server setup packet. When the new option is *not* used, the setup packet is now 2 bytes larger than before. On the server side, the slave process now uses execvpe() instead of execvp(). There’s plumbing to propagate a new ‘envp’ argument from term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we use ‘environ’ instead (thus matching the old behavior of execvp()). Closes #1004
* user-notification: 'productify' the user-warning systemDaniel Eklöf2020-07-30-2/+2
| | | | | | | | * Rename user_warning to user_notification * Add warning and error types (in addition to the existing deprecated) * Simplify logic when emitting a user notification after forking; we don't need to copy the notification data since we're in a new process and have total control over that memory.
* term: add capability to print warnings *inside* the terminalDaniel Eklöf2020-07-29-1/+4
| | | | | This is intended to be used to print e.g. deprecation warnings inside the terminal, *before* the shell is started.
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-1/+1
|
* term: term_init: add 'cwd' argumentDaniel Eklöf2019-12-21-1/+2
| | | | | | | | | | 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.
* slave: set TERM environment variable in slave processDaniel Eklöf2019-11-01-1/+1
|
* term: move client startup to a new function, slave_spawn()Daniel Eklöf2019-10-30-1/+4
|
* slave: rename slave_spawn() -> slave_exec()Daniel Eklöf2019-10-30-1/+1
|
* main: allow user to override shell on the command lineDaniel Eklöf2019-07-17-1/+1
|
* slave: report exec() failure back to main processDaniel Eklöf2019-07-17-1/+1
|
* slave: exec shell from confDaniel Eklöf2019-07-17-1/+1
|
* Set up pseudo terminal and fork slaveDaniel Eklöf2019-06-13-0/+4