Commit Graph

19 Commits

Author SHA1 Message Date
Thomas Orozco b67a024460 Rename NO_ARGS to MINIMAL 2016-11-04 18:06:25 +01:00
Michael Crosby 51df7df854 Handle execve exit status
This changes the execve exit status for the child process to be inline
with standard exit status codes for common execve failures.

I don't think this breaks any backwards compat with existing tini users
because it is still returning a non zero exit status but with correct
codes providing more information why it failed.
2016-11-04 13:25:14 +01:00
Thomas Orozco b3a2ba638e NO_ARGS: White labelling
- Don't mention options that don't exist in Usage.
- Don't include a log prefix when NO_ARGS is set.
- Turn up the default verbosity to FATAL when NO_ARGS is set.
- Expose verbosity via an ENV var for debugging.
2016-11-04 13:22:41 +01:00
Thomas Orozco c9ff1b6917 Add a --version flag
See: https://github.com/krallin/tini/issues/55
2016-11-03 19:32:59 +01:00
Thomas Orozco 480fed14ae Optionally disable arg parsing (-DNO_ARGS=ON) 2016-11-02 18:05:12 +01:00
Thomas Orozco 203835d2a6 Remove obsolete comment
tini -h does exit with 0 via `parse_fail_exitcode_ptr`.
2016-08-10 08:52:20 +02:00
Thomas Orozco be71d120e7 Embed license and add -l flag to show it
This adds 1k of weight to the resulting binary, which is reasonable
(it's less than 5% for the smaller non-static binary), but alleviates
legitimate user concern that the license requires being included when
Tini is redistributed.
2016-08-10 08:50:47 +02:00
Thomas Orozco 1ee5e650a3 Clarify that log messages are coming from Tini
Since we're ignoring SIGTTOU (for good reason), our log messages
could show in another program's output. To make the life of users
easier, let's clarify that the messages are owned by Tini.
2015-10-31 15:31:57 +01:00
Thomas Orozco 88342efc3c Ensure Tini doesn't lock up on of tty ownership
In the rare scenario where Tini is not running as PID 1 and its
child (or something else) sets TOSTOP on the tty, then Tini would
hang when if it tries to write debug messages. This commit fixes
this problem by ignoring SIGTTOU.

In the also rare scenario where two Tini instances are running, the
tty-passing could end up being done improperly (if the parent Tini
instance passes the tty to the child before the grandparent Tini
instance passes it to the parent Tini instance), and result in the
parent Tini instance running in the foreground. This commit fixes
this problem by passing the tty in the child (which we can do
because we are ignoring SIGTTOU).
2015-10-31 15:31:57 +01:00
Thomas Orozco 82acbc5ccc Make child process group foreground on active tty
When a tty is available, make the child process group foreground on
(and graciously fallback if no tty is available).

Fix #19
2015-10-31 15:31:57 +01:00
Thomas Orozco d4832f47ed Use unsigned ints for configuration
Let's avoid signed integer overflow if someone ends up passing
the same CLI argument thousands and thousands of times.
2015-10-27 19:54:15 +01:00
David Wragg 109019f917 Support for killing the whole child process group
tini only kills the immediate child process.  This means that if you
do, for example,

    docker run krallin/ubuntu-tini sh -c 'sleep 10'

and ctrl-C it, nothing happens: SIGINT is sent to the 'sh' process,
but that shell won't react to it while it is waiting for the 'sleep'
to finish.

This change adds a -g option to put the child process of tini into a
new process group, and sends signals to that group, so that every
process in the group gets a signal.  This corresponds more closely to
what happens when you do ctrl-C etc. in a terminal: The signal is sent
to the foreground process group.

So if you try the example above with a container image that passes -g
to tini, the SIGINT will be received by the 'sleep', and the container
promptly exits.
2015-10-26 21:52:06 +01:00
Thomas Orozco 405eea7941 More robust git version checking
- Check the exit code from git log to check if we have a version.
- Add a "-dirty" suffix if the repo is dirty when the build is made.
2015-10-16 15:23:10 -07:00
Thomas Orozco 5650d29790 Only mention child subreaping if it's available
Tini can be built without child subreaper support. The warning message
shouldn't suggest using it if it's not available
2015-09-06 15:37:05 +02:00
Thomas Orozco e1b463cdf5 Allow subreaping to be controlled with an env var
This allows users to enable subreaping even if they aren't the ones
calling Tini.
2015-09-01 21:17:10 +02:00
Thomas Orozco 376d186b2e Set default verbosity level to 1
This means warnings always show warnings, which is the right thing to do
considering the 2 warnings we show are actually for important
information.
2015-09-01 21:17:10 +02:00
Thomas Orozco bcb8a4b870 Allow users to enable sub-reaping
This allows users that don't control PID 1 in their container to still
use Tini to reap zombies.
2015-09-01 21:17:10 +02:00
Thomas Orozco 1c52aee22c Use const in spawn, remove redundant () 2015-04-04 15:47:49 +02:00
Thomas Orozco 5bba1c35e5 Move code into ./src 2015-03-15 17:50:19 +01:00