mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-01-07 03:00:14 +01:00
powerprofilesctl: Exit with launched process exit code
This is a regression of commit 18a9c6668, due to the fact that the
argparse func return value is simply ignored.
So let's just exit directly with the provided return value in such case.
This commit is contained in:
parent
9bc5643950
commit
15c74efc7e
2 changed files with 15 additions and 2 deletions
|
|
@ -139,7 +139,7 @@ def _launch(args):
|
|||
ret = launched_app.returncode
|
||||
proxy.ReleaseProfile("(u)", cookie)
|
||||
|
||||
return ret
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
def get_parser():
|
||||
|
|
|
|||
|
|
@ -1760,6 +1760,18 @@ class Tests(dbusmock.DBusTestCase):
|
|||
tool_cmd + ["--foo-arg", "launch", "true"], stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
def test_launch_with_command_failure(self):
|
||||
self.create_platform_profile()
|
||||
self.start_daemon()
|
||||
self.assert_eventually(lambda: self.get_dbus_property("ActiveProfile"))
|
||||
|
||||
tool_cmd = self.powerprofilesctl_command()
|
||||
cmd = subprocess.run(tool_cmd + ["launch", "false"], check=False)
|
||||
self.assertEqual(cmd.returncode, 1)
|
||||
|
||||
cmd = subprocess.run(tool_cmd + ["launch", "sh", "-c", "exit 55"], check=False)
|
||||
self.assertEqual(cmd.returncode, 55)
|
||||
|
||||
def test_vanishing_hold(self):
|
||||
self.create_platform_profile()
|
||||
self.start_daemon()
|
||||
|
|
@ -1780,7 +1792,8 @@ class Tests(dbusmock.DBusTestCase):
|
|||
|
||||
# Make sure to handle vanishing clients
|
||||
launch_process.terminate()
|
||||
self.assertEqual(launch_process.wait(), 0)
|
||||
retcode = launch_process.wait()
|
||||
self.assertTrue(os.WIFSIGNALED(retcode))
|
||||
|
||||
holds = self.get_dbus_property("ActiveProfileHolds")
|
||||
self.assertEqual(len(holds), 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue