feat(utils): add set_process_name utility and adjust imports
New Features - Added `set_process_name` function to set the process name via `prctl`. Enhancements - Replaced `loguru` logger import with `fabric.utils.logger` and removed the unused dependency. - Added explicit imports of `ctypes`, `html`, and `json` for clarity and future use. Bug Fixes - No bug fixes included in this change.
This commit is contained in:
1 file changed
+9
-2
+9
-2
@@ -1,10 +1,17 @@
|
|||||||
|
import ctypes
|
||||||
import html
|
import html
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import threading
|
import threading
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from loguru import logger
|
from fabric.utils import logger, os
|
||||||
|
|
||||||
|
|
||||||
|
# Function to set the process name
|
||||||
|
def set_process_name(name: str):
|
||||||
|
libc = ctypes.CDLL("libc.so.6")
|
||||||
|
libc.prctl(15, name.encode("utf-8"), 0, 0, 0)
|
||||||
|
|
||||||
|
|
||||||
# Threading helper functions
|
# Threading helper functions
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user