Add error handling for subprocess output in dtrace scripts

This commit is contained in:
Karol Mazurek
2025-06-10 18:36:34 +02:00
parent 1a00625b0f
commit 3f1f2e6228
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -64,7 +64,8 @@ def main():
stdout=subprocess.PIPE,
text=True,
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.
+2 -1
View File
@@ -68,7 +68,8 @@ def main():
stdout=subprocess.PIPE,
text=True,
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.