@@ -101,7 +101,7 @@ async def run(self):
101
101
await proc .wait ()
102
102
103
103
while proc .returncode == SUSP_CODE :
104
- if not self .is_inhibiting :
104
+ if self .is_inhibiting is not True :
105
105
self .is_inhibiting = True
106
106
print (f'{ self .name } is inhibiting '
107
107
f'suspend (return={ proc .returncode } )' )
@@ -128,10 +128,6 @@ def init():
128
128
opt .add_argument ('-i' , '--inhibit' , help = argparse .SUPPRESS )
129
129
args = opt .parse_args ()
130
130
131
- # Don't run if this system does not support sleep
132
- if not Path ('/sys/power/state' ).read_text ():
133
- sys .exit ('System does not support any sleep states, quitting.' )
134
-
135
131
# This instance may be a child invocation merely to run and check
136
132
# the plugin while it is inhibiting.
137
133
if args .inhibit :
@@ -142,6 +138,11 @@ def init():
142
138
if res .returncode != SUSP_CODE :
143
139
sys .exit (res .returncode )
144
140
141
+ # Don't run if this system does not support sleep
142
+ pstate = Path ('/sys/power/state' )
143
+ if not pstate .exists () or not pstate .read_text ().strip ():
144
+ sys .exit ('System does not support any sleep states, quitting.' )
145
+
145
146
prog = Path (sys .argv [0 ]).resolve ()
146
147
progname = prog .stem .replace ('_' , '-' )
147
148
0 commit comments