mirror of
https://github.com/Karmaz95/Snake_Apple.git
synced 2026-07-04 19:17:48 +02:00
Add error handling for subprocess output in dtrace scripts
This commit is contained in:
Regular → Executable
+2
-1
@@ -64,7 +64,8 @@ def main():
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
text=True,
|
text=True,
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
preexec_fn=os.setsid
|
preexec_fn=os.setsid,
|
||||||
|
errors="replace" # <-- Add this argument to handle decode errors
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use a thread-safe event to ensure the signal handler logic runs only once.
|
# Use a thread-safe event to ensure the signal handler logic runs only once.
|
||||||
|
|||||||
Regular → Executable
+2
-1
@@ -68,7 +68,8 @@ def main():
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
text=True,
|
text=True,
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
preexec_fn=os.setsid
|
preexec_fn=os.setsid,
|
||||||
|
errors="replace" # Handle decode errors gracefully
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use a thread-safe event to ensure the signal handler logic runs only once.
|
# Use a thread-safe event to ensure the signal handler logic runs only once.
|
||||||
|
|||||||
Reference in New Issue
Block a user