1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-13 14:18:14 +00:00

Ensure I/O executor

This commit is contained in:
J. Nick Koston 2023-11-17 22:03:07 -06:00
parent 3c243e663f
commit 95c7236faa
No known key found for this signature in database

View File

@ -756,9 +756,15 @@ class EditRequestHandler(BaseHandler):
@authenticated
@bind_config
def post(self, configuration=None):
with open(file=settings.rel_path(configuration), mode="wb") as f:
async def post(self, configuration=None):
# Atomic write
config_file = settings.rel_path(configuration)
with open(file=config_file, mode="wb") as f:
f.write(self.request.body)
await async_run_system_command(
[*DASHBOARD_COMMAND, "compile", "--only-generate", config_file]
)
self.set_status(200)