suppress FileNotFound exception instead of missing_ok=True because the latter is added in python 3.8 and we claim to support >3.6

This commit is contained in:
Dmitry Rodionov
2021-10-19 16:39:26 +03:00
committed by Dmitry Rodionov
parent 732d13fe06
commit 798df756de

View File

@@ -14,7 +14,7 @@ import subprocess
import time
import filecmp
from contextlib import closing
from contextlib import closing, suppress
from pathlib import Path
from dataclasses import dataclass
@@ -829,7 +829,8 @@ class WalAcceptor:
def start(self) -> 'WalAcceptor':
# create data directory if not exists
self.data_dir.mkdir(parents=True, exist_ok=True)
self.pidfile.unlink(missing_ok=True)
with suppress(FileNotFoundError):
self.pidfile.unlink()
cmd = [str(self.wa_bin_path)]
cmd.extend(["-D", str(self.data_dir)])