mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-01 02:07:58 +02:00
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:
parent
b26d928ddd
commit
3247b511e2
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue