Fix running test suite without root

Running Tests.test_fake_driver breaks stdin on a real terminal unless
the test suite is run as root.  It doesn't make sense for the fake
driver to capture stdin unless we are sure that we're interactive.

Lookup whether stdout is a tty and only run the keyboard setup in
probe for the fake driver if we're sure we're interactive.
This commit is contained in:
Mario Limonciello 2024-02-07 23:13:06 -06:00
parent b26d928ddd
commit 3247b511e2

View file

@ -150,6 +150,10 @@ ppd_driver_fake_probe (PpdDriver *driver)
if (!envvar_set ("POWER_PROFILE_DAEMON_FAKE_DRIVER"))
return PPD_PROBE_RESULT_FAIL;
/* don't activate stdin unless interactive */
if (isatty (fileno (stdout)) == 0)
return PPD_PROBE_RESULT_SUCCESS;
fake = PPD_DRIVER_FAKE (driver);
if (!setup_keyboard (fake))
return PPD_PROBE_RESULT_FAIL;