File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
custom_components/config_editor Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,10 @@ def drec(r, s):
6666 content = ''
6767 res = 'Loaded'
6868 try :
69- with open (fullpath , encoding = "utf-8" ) as fdesc :
70- content = fdesc .read ()
69+ def read ():
70+ with open (fullpath , encoding = "utf-8" ) as fdesc :
71+ return fdesc .read ()
72+ content = await hass .async_add_executor_job (read )
7173 except :
7274 res = 'Reading Failed'
7375 _LOGGER .exception ("Reading failed: %s" , fullpath )
@@ -96,12 +98,16 @@ def drec(r, s):
9698 gid = 0
9799 with AtomicWriter (fullpath , overwrite = True ).open () as fdesc :
98100 fdesc .write (content )
99- with open (fullpath , 'a' ) as fdesc :
100- try :
101- os .fchmod (fdesc .fileno (), mode )
102- os .fchown (fdesc .fileno (), uid , gid )
103- except :
104- pass
101+
102+ def permi ():
103+ with open (fullpath , 'a' ) as fdesc :
104+ try :
105+ os .fchmod (fdesc .fileno (), mode )
106+ os .fchown (fdesc .fileno (), uid , gid )
107+ except :
108+ pass
109+ await hass .async_add_executor_job (permi )
110+
105111 except :
106112 res = "Saving Failed"
107113 _LOGGER .exception (res + ": %s" , fullpath )
You can’t perform that action at this time.
0 commit comments