main: Follow pylint recommendation and use "with"

src/powerprofilesctl:185:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Closes: #35
This commit is contained in:
Bastien Nocera 2021-08-05 15:58:24 +02:00
parent 417c830355
commit 42b3341b29

View file

@ -182,8 +182,8 @@ def _launch(args, profile, appid, reason):
signal.signal(signal.SIGTERM, receive_signal)
# print (f'Got {cookie} for {profile} hold')
launched_app = subprocess.Popen(args)
launched_app.wait()
with subprocess.Popen(args) as launched_app:
launched_app.wait()
proxy.ReleaseProfile('(u)', cookie)
def main(): # pylint: disable=too-many-branches, disable=too-many-statements