File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1382,7 +1382,6 @@ int main(int argc, char *argv[]) {
13821382 saved_argv = argv ;
13831383 saved_argc = argc ;
13841384
1385- log_show_color (colors_enabled ());
13861385 log_set_upgrade_syslog_to_journal (true);
13871386
13881387 /* Disable the umask logic */
@@ -1393,7 +1392,6 @@ int main(int argc, char *argv[]) {
13931392
13941393 /* Running outside of a container as PID 1 */
13951394 arg_system = true;
1396- make_null_stdio ();
13971395 log_set_target (LOG_TARGET_KMSG );
13981396 log_open ();
13991397
@@ -1511,12 +1509,19 @@ int main(int argc, char *argv[]) {
15111509
15121510 /* We expect the environment to be set correctly if run inside a
15131511 * container. */
1514- if (arg_system && detect_container () <= 0 )
1512+ if (arg_system && detect_container () <= 0 ) {
15151513 if (fixup_environment () < 0 ) {
15161514 error_message = "Failed to fix up PID1 environment" ;
15171515 goto finish ;
15181516 }
15191517
1518+ /* Try to figure out if we can use colors with the console. No
1519+ * need to do that for user instances since they never log
1520+ * into the console. */
1521+ log_show_color (colors_enabled ());
1522+ make_null_stdio ();
1523+ }
1524+
15201525 /* Initialize default unit */
15211526 r = free_and_strdup (& arg_default_unit , SPECIAL_DEFAULT_TARGET );
15221527 if (r < 0 ) {
You can’t perform that action at this time.
0 commit comments