Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix IPC bug
  • Loading branch information
StephenNneji committed Nov 3, 2025
commit c76c6465e293e6c607651cab2810a9b019e366e1
5 changes: 3 additions & 2 deletions ratapi/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __str__(self) -> str:
def initialise_IPC(self):
"""Set up the inter-process communication file."""
IPC_obj, self._IPCFilePath = tempfile.mkstemp()
os.write(IPC_obj, b"0")
os.write(IPC_obj, b"\x00")
os.close(IPC_obj)
return None

Expand All @@ -221,7 +221,7 @@ def sendStopEvent(self):
"""
if os.path.isfile(self._IPCFilePath):
with open(self._IPCFilePath, "wb") as f:
f.write(b"1")
f.write(b"\x01")
else:
warnings.warn("An IPC file was not initialised.", UserWarning, stacklevel=2)
return None
Expand All @@ -230,6 +230,7 @@ def delete_IPC(self):
"""Delete the inter-process communication file."""
with contextlib.suppress(FileNotFoundError):
os.remove(self._IPCFilePath)
self._IPCFilePath = ""
return None

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