Skip to content

Commit c76c646

Browse files
committed
Fix IPC bug
1 parent ddc3c31 commit c76c646

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ratapi/controls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __str__(self) -> str:
206206
def initialise_IPC(self):
207207
"""Set up the inter-process communication file."""
208208
IPC_obj, self._IPCFilePath = tempfile.mkstemp()
209-
os.write(IPC_obj, b"0")
209+
os.write(IPC_obj, b"\x00")
210210
os.close(IPC_obj)
211211
return None
212212

@@ -221,7 +221,7 @@ def sendStopEvent(self):
221221
"""
222222
if os.path.isfile(self._IPCFilePath):
223223
with open(self._IPCFilePath, "wb") as f:
224-
f.write(b"1")
224+
f.write(b"\x01")
225225
else:
226226
warnings.warn("An IPC file was not initialised.", UserWarning, stacklevel=2)
227227
return None
@@ -230,6 +230,7 @@ def delete_IPC(self):
230230
"""Delete the inter-process communication file."""
231231
with contextlib.suppress(FileNotFoundError):
232232
os.remove(self._IPCFilePath)
233+
self._IPCFilePath = ""
233234
return None
234235

235236
def save(self, filepath: str | Path = "./controls.json"):

0 commit comments

Comments
 (0)