[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Process renaming requires ASCII bytes



commit 2850199fc513fc4a276e16eaa59ccbc2dc69ea23
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jan 27 19:21:20 2013 -0800

    Process renaming requires ASCII bytes
    
    Yet another unicode/ASCII compatability issue...
    
    ======================================================================
    ERROR: test_set_process_name
    ----------------------------------------------------------------------
    Traceback:
      File "/home/atagar/Desktop/stem/test/data/python3/test/integ/util/system.py", line 409, in test_set_process_name
        stem.util.system.set_process_name("stem_integ")
      File "/home/atagar/Desktop/stem/test/data/python3/stem/util/system.py", line 764, in set_process_name
        _set_prctl_name(process_name)
      File "/home/atagar/Desktop/stem/test/data/python3/stem/util/system.py", line 809, in _set_prctl_name
        name_buffer.value = process_name
    TypeError: str/bytes expected instead of str instance
    
    During handling of the above exception, another exception occurred:
    
    Traceback:
      File "/home/atagar/Desktop/stem/test/data/python3/test/integ/util/system.py", line 412, in test_set_process_name
        stem.util.system.set_process_name(initial_name)
      File "/home/atagar/Desktop/stem/test/data/python3/stem/util/system.py", line 764, in set_process_name
        _set_prctl_name(process_name)
      File "/home/atagar/Desktop/stem/test/data/python3/stem/util/system.py", line 809, in _set_prctl_name
        name_buffer.value = process_name
    TypeError: str/bytes expected instead of str instance
---
 stem/util/system.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index f61c3d8..3a11161 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -33,6 +33,7 @@ import subprocess
 import time
 
 import stem.util.proc
+import stem.util.str_tools
 
 from stem import UNDEFINED
 from stem.util import log
@@ -806,7 +807,7 @@ def _set_prctl_name(process_name):
 
   libc = ctypes.CDLL(ctypes.util.find_library("c"))
   name_buffer = ctypes.create_string_buffer(len(process_name) + 1)
-  name_buffer.value = process_name
+  name_buffer.value = stem.util.str_tools.to_bytes(process_name)
   libc.prctl(PR_SET_NAME, ctypes.byref(name_buffer), 0, 0, 0)
 
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits