DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(timezone_mode, TimezoneMode, TIMEZONE_AUTO);
static const char *const console_mode_table[_CONSOLE_MODE_MAX] = {
+ [CONSOLE_AUTOPIPE] = "autopipe",
[CONSOLE_INTERACTIVE] = "interactive",
[CONSOLE_READ_ONLY] = "read-only",
[CONSOLE_PASSIVE] = "passive",
STATIC_DESTRUCTOR_REGISTER(arg_background, freep);
static int handle_arg_console(const char *arg) {
- if (streq(arg, "help")) {
- puts("autopipe\n");
+ if (streq(arg, "help"))
return DUMP_STRING_TABLE(console_mode, ConsoleMode, _CONSOLE_MODE_MAX);
- }
- if (streq(arg, "autopipe")) {
- if (isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
- arg_console_mode = CONSOLE_INTERACTIVE;
- else
- arg_console_mode = CONSOLE_PIPE;
- } else
- arg_console_mode = console_mode_from_string(optarg);
+ arg_console_mode = console_mode_from_string(optarg);
if (arg_console_mode < 0)
return log_error_errno(arg_console_mode, "Unknown console mode: %s", optarg);
arg_console_mode = isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO) ?
CONSOLE_INTERACTIVE : CONSOLE_READ_ONLY;
+ if (arg_console_mode == CONSOLE_AUTOPIPE) {
+ if (isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
+ arg_console_mode = CONSOLE_INTERACTIVE;
+ else
+ arg_console_mode = CONSOLE_PIPE;
+ }
+
if (arg_console_mode == CONSOLE_PIPE) /* if we pass STDERR on to the container, don't add our own logs into it too */
arg_quiet = true;