File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1190,10 +1190,10 @@ pub fn run_atuin(ctx: &ExecutionContext) -> Result<()> {
11901190
11911191pub fn reboot ( ctx : & ExecutionContext ) -> Result < ( ) > {
11921192 // Prefer `systemctl reboot` on systemd-based systems
1193- if Path :: new ( "/run/systemd/system" ) . exists ( ) {
1194- if let Ok ( systemctl) = require ( "systemctl" ) {
1195- return ctx . execute ( systemctl ) . arg ( "reboot" ) . status_checked ( ) ;
1196- }
1193+ if Path :: new ( "/run/systemd/system" ) . exists ( )
1194+ && let Ok ( systemctl) = require ( "systemctl" )
1195+ {
1196+ return ctx . execute ( systemctl ) . arg ( "reboot" ) . status_checked ( ) ;
11971197 }
11981198
11991199 match ctx. sudo ( ) {
@@ -1204,10 +1204,10 @@ pub fn reboot(ctx: &ExecutionContext) -> Result<()> {
12041204
12051205pub fn poweroff ( ctx : & ExecutionContext ) -> Result < ( ) > {
12061206 // Prefer `systemctl poweroff` on systemd-based systems
1207- if Path :: new ( "/run/systemd/system" ) . exists ( ) {
1208- if let Ok ( systemctl) = require ( "systemctl" ) {
1209- return ctx . execute ( systemctl ) . arg ( "poweroff" ) . status_checked ( ) ;
1210- }
1207+ if Path :: new ( "/run/systemd/system" ) . exists ( )
1208+ && let Ok ( systemctl) = require ( "systemctl" )
1209+ {
1210+ return ctx . execute ( systemctl ) . arg ( "poweroff" ) . status_checked ( ) ;
12111211 }
12121212
12131213 match ctx. sudo ( ) {
You can’t perform that action at this time.
0 commit comments