Closed rbong closed 8 years ago
Didn't this commit 6b822b53928e452786df9ee36628889f7bec4b8a fixed the issue? For me it now works.
I somehow got an old commit.
Edit: Began putting together this issue before the commit.
Many thanks! I completely agree with you, modifying now. :)
When I run the script, I get an error and the following traceback:
The offending function is this:
The issue for me is that when it uses re.search(process, x), x is a bytearray. subprocess gets its locale from locale.getlocale. This solution would work with both strings and any encoding.
However, this function has another problem.
As you might've guessed, I don't have a process called "firefo" running on my system. We could tweak the search function a bit with regex, but it's not worth it. Here's a better solution for the whole function.
Since "--" blocks further arguments (for my implementation of pidof, at least) the function should only throw subprocess.CalledProcessError if the function is not running according to my pidof man page. Here are the results of a test:
There are two downsides to this method. The first is that it is not portable on Windows (however you do not support Windows in this fork). The second is that you cannot search for processes by regular expression as re's search function supports (however you do not use regex in this fork). It is for these reasons I'm going to hold off on a pull request, as I'm sure you have your own ideas about the best way to fix this function that preserves the potential for extension you appear to have planned in the original function.