mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: Use action_utils.run instead of subprocess.call
- This is to capture stdout and stderr and transmit that from privileged daemon back to the service to be displayed in HTML. Tests: - Unit tests and code checks pass. - Some of the modified actions work as expected. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
1 parent
80e6d940a4
commit
bf9005ac48
5 files changed
+15
-17
No files matched your search
@@ -1,18 +1,17 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""Shutdown/restart the system."""
|
||||
|
||||
import subprocess
|
||||
|
||||
from plinth import action_utils
|
||||
from plinth.actions import privileged
|
||||
|
||||
|
||||
@privileged
|
||||
def restart():
|
||||
"""Restart the system."""
|
||||
subprocess.call('reboot')
|
||||
action_utils.run('reboot', check=False)
|
||||
|
||||
|
||||
@privileged
|
||||
def shutdown():
|
||||
"""Shut down the system."""
|
||||
subprocess.call(['shutdown', 'now'])
|
||||
action_utils.run(['shutdown', 'now'], check=False)
|
||||
Reference in new issue
Block a user