aboutsummaryrefslogtreecommitdiff
path: root/slave.h (unfollow)
Commit message (Collapse)AuthorLines
2024-01-11slave: don't skip setting environment variables when using a custom environmentDaniel Eklöf-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
2022-06-13config: add a new ‘environment’ sectionDaniel Eklöf-1/+3
This section allows the user to define custom environment variables to be set in the child process: [environment] name=value
2022-04-12client: add -E,--client-environmentDaniel Eklöf-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
2020-10-10selection: use appropriate check for PRIMARY pasteSergey Nazaryev-3/+1
Assume it could be a copy-paste typo. We should check PRIMARY, not CLIPBOARD. Without this fix, we can't use PRIMARY until we copy anything to CLIPBOARD.
2020-07-30user-notification: 'productify' the user-warning systemDaniel Eklöf-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.
2020-07-29term: add capability to print warnings *inside* the terminalDaniel Eklöf-1/+4
This is intended to be used to print e.g. deprecation warnings inside the terminal, *before* the shell is started.
2020-02-20slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf-1/+1
2019-12-21term: term_init: add 'cwd' argumentDaniel Eklöf-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.
2019-11-01slave: set TERM environment variable in slave processDaniel Eklöf-1/+1
2019-10-30term: move client startup to a new function, slave_spawn()Daniel Eklöf-1/+4
2019-10-30slave: rename slave_spawn() -> slave_exec()Daniel Eklöf-1/+1
2019-07-17main: allow user to override shell on the command lineDaniel Eklöf-1/+1
2019-07-17slave: report exec() failure back to main processDaniel Eklöf-1/+1
2019-07-17slave: exec shell from confDaniel Eklöf-1/+1
2019-06-13Set up pseudo terminal and fork slaveDaniel Eklöf-0/+4