Commit Graph

65 Commits

Author SHA1 Message Date
nicm
7a4ba6d4a5 Mention that if-shell and #() use /bin/sh. 2022-02-01 12:05:42 +00:00
deraadt
9b4148b12c For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert
2021-10-24 21:24:17 +00:00
nicm
759efe1b33 Add -e flag to set environment for popup, from Alexis Hildebrandt in
GitHub issue 2924.
2021-10-11 10:55:30 +00:00
nicm
7a0cec5ecf Fill in some other bits on new panes. 2021-08-13 19:55:11 +00:00
nicm
2588c3e52e Add menu options to convert a popup into a pane. 2021-08-13 19:27:25 +00:00
nicm
c44750792a Drop support for popups where the content is provided directly to tmux
(which does not have many practical uses) and only support running a
program in the popup. display-popup is now simpler and can accept
multiple arguments to avoid escaping problems (like the other commands).
2021-03-02 10:56:45 +00:00
nicm
b04f8acb70 Check return value of chdir() to stop a silly warning with some
compilers, GitHub issue 2573.
2021-02-19 09:09:16 +00:00
nicm
78595457f9 Add 'e' key in buffer mode to open the buffer in an editor. 2020-05-16 15:24:28 +00:00
nicm
8a838b0372 Add support for overlay popup boxes to show text or output temporarily
above the normal layout. These work similarly to menus and are created
with the display-popup command.
2020-03-24 08:09:43 +00:00
nicm
e8273a993e Add a flag to run a background process in a pty as well, not used for
anything yet.
2020-03-19 13:43:18 +00:00
deraadt
4ff7bc3eb3 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:35:05 +00:00
nicm
749f67b7d8 evbuffer_new and bufferevent_new can both fail (when malloc fails) and
return NULL. GitHub issue 1547.
2018-11-19 13:35:40 +00:00
nicm
d5b92ac37e Do not printf NULL. 2018-10-28 16:10:02 +00:00
nicm
228e1a3951 Use same working directory rules for jobs as new windows rather than
always starting in home, GitHub issue 1488.
2018-09-27 07:43:18 +00:00
nicm
f38b5a1b58 all_jobs can be static. 2018-08-23 18:39:12 +00:00
nicm
bceccc6b63 Move job struct into job.c. 2018-08-23 15:45:05 +00:00
nicm
19f3a5c612 Add a missing client-detached hook when the server shuts down, and do
not exit until jobs started from run-shell/if-shell have finished (add a
job flags member and a flag to indicate other jobs). GitHub issue 1245.
2018-03-08 08:09:10 +00:00
nicm
932f6cfbfc Because ignore SIGCHLD early, letting signal_del restore it doesn't work
correctly, so set it explicitly back to default (and the others for good
measure).
2017-07-14 18:49:07 +00:00
nicm
51112221ee Block signals between forking and clearing signal handlers (or calling
event_reinit) - if the child gets a signal and fires the libevent signal
handler during this period it could write a signal into the parent's
signal pipe. GitHub issue 1001 from Aaron van Geffen.
2017-07-12 10:04:51 +00:00
nicm
0453ad0146 Move signal code into proc.c. 2017-07-12 09:24:17 +00:00
nicm
248aa54bfd Style and spacing nits. 2017-05-31 17:56:48 +00:00
nicm
c48d09ec88 Do not update TERM into config file parsing has finished. 2017-04-25 15:35:10 +00:00
nicm
0b44ad99b5 If a #() command doesn't exit, use its most recent line of output (it
must be a full line). Don't let it redraw the status line more than once
a second.

Requested by someone about 10 years ago...
2017-04-20 09:20:22 +00:00
nicm
dbfee6a468 Move server_fill_environ into environ.c and move some other common code
into it.
2017-03-09 17:02:38 +00:00
nicm
c426e485e5 Loads more static, except for cmd-*.c and window-*.c. 2016-10-10 21:29:23 +00:00
nicm
995af0e2b7 I no longer use my SourceForge address so replace it. 2016-01-19 15:59:12 +00:00
nicm
577c0e3e5a Use __unused rather than rolling our own. 2015-11-18 14:27:44 +00:00
nicm
01defc9f49 Because pledge(2) does not allow us to pass directory file descriptors
around, we can't use file descriptors for the working directory because
we will be unable to pass it to a privileged process to tell it where to
read or write files or spawn children. So move tmux back to using
strings for the current working directory. We try to check it exists
with access() when it is set but ultimately fall back to ~ if it fails
at time of use (or / if that fails too).
2015-10-31 08:13:58 +00:00
nicm
bf9c933cae Like options, move the environ struct into environ.c. 2015-10-28 09:51:55 +00:00
nicm
021cdbe1c0 Use an explicit job state instead of avoid closing our side of the
socketpair and setting it to -1 to mark when the other side is
closed. This avoids closing it while the libevent bufferevent still has
it (it could try to add it to the polled set which some mechanisms don't
like). Fixes part a problem reported by Bruno Sutic.
2015-06-17 16:44:49 +00:00
nicm
583b4ab72b Set working directory for run-shell and if-shell. 2015-04-24 22:19:36 +00:00
nicm
900f6fc17e Tidy up some includes. 2014-10-20 23:27:14 +00:00
nicm
a47d2397df Don't leak socketpair file descriptors if fork fails. Spotted by Balazs
Kezes.
2014-04-14 22:27:30 +00:00
nicm
99e3cbc526 Use format_get_command() and some spacing tweaks. 2013-10-10 12:35:30 +00:00
Nicholas Marriott
88428cff3a %zu format for size_t. 2013-04-17 08:41:41 +00:00
Nicholas Marriott
9fcda95a6f Set EV_WRITE for jobs or run/if-shell jobs can hang. From Chris Johnsen. 2013-04-10 12:20:35 +00:00
Nicholas Marriott
d28a39d01d Extend jobs to support writing and use that for copy-pipe instead of
popen, from Chris Johnsen.
2013-03-25 11:43:01 +00:00
Nicholas Marriott
8d59b189cc No more lint means no more ARGSUSED. 2013-03-22 10:31:22 +00:00
Nicholas Marriott
df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Nicholas Marriott
9bbc63ed65 Call bufferevent_free before closing file descriptor associated with it
or bugs in $EventMechanism on $OtherOS makes libevent get it's knickers
in a twist. From Dylan Alex Simon.
2012-01-29 02:22:11 +00:00
Nicholas Marriott
db7a89b1ee Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.

Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.

This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
2011-01-26 01:54:56 +00:00
Nicholas Marriott
4dfb29fa38 Use LIST_* not SLIST_*. 2011-01-26 00:11:47 +00:00
Nicholas Marriott
b8023044c3 Set $TMUX without the session when background jobs are run. 2011-01-23 11:03:43 +00:00
Nicholas Marriott
69cb1f830e Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things
like "tmux ls && cat").
2011-01-08 01:52:36 +00:00
Nicholas Marriott
f56b4ec2ff Trying to set FD_CLOEXEC on every fd is a lost cause, just use
closefrom() before exec.
2010-10-16 08:31:55 +00:00
Nicholas Marriott
e3be9b1951 Do not call event_del() for signals after fork(), just use sigaction()
directly instead - calling libevent functions after fork() w/o
event_reinit() is a bad idea, even if in this case it was harmless.
2010-08-19 18:29:01 +00:00
Nicholas Marriott
c4a2fdf15b Put this back in with the initialisation in the right order. 2010-05-04 17:28:16 +00:00
Nicholas Marriott
af5e0bd15a Revert last change, it appears to be broken somehow. 2010-05-04 08:48:06 +00:00
Nicholas Marriott
ec1d37b1b2 Make signal handler setup/teardown two common functions instead of six,
and reset SIGCHLD after fork to fix problems with some shells. From
Romain Francois.
2010-05-03 16:06:32 +00:00
Nicholas Marriott
b02cd35354 Run job commands explicitly in the global enviroment (which can be
modified with setenv -g) rather than with the environment tmux started
with.
2010-04-04 19:02:09 +00:00