mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
Use context manager instead of assignment
This commit is contained in:
parent
e0c55c4f84
commit
ddf15247e3
1 changed files with 15 additions and 16 deletions
|
@ -530,7 +530,7 @@ def configure_plex():
|
||||||
def configure_niceness():
|
def configure_niceness():
|
||||||
global NICENESS
|
global NICENESS
|
||||||
|
|
||||||
devnull = open(os.devnull, 'w')
|
with open(os.devnull, 'w') as devnull:
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(['nice'], stdout=devnull, stderr=devnull).communicate()
|
subprocess.Popen(['nice'], stdout=devnull, stderr=devnull).communicate()
|
||||||
NICENESS.extend(['nice', '-n{0}'.format(int(CFG['Posix']['niceness']))])
|
NICENESS.extend(['nice', '-n{0}'.format(int(CFG['Posix']['niceness']))])
|
||||||
|
@ -551,7 +551,6 @@ def configure_niceness():
|
||||||
pass
|
pass
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
devnull.close()
|
|
||||||
|
|
||||||
|
|
||||||
def initialize(section=None):
|
def initialize(section=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue