INNER CODE UNIT · Python
is_proc_path
kellyjonbrazil/jc · jc/cli.py:513
def is_proc_path(path_string: str) -> bool:
# normpath, not realpath: /proc is full of symlinks that must keep working
normalized_path: str = posixpath.normpath(re.sub(r'^/+', '/', path_string))
return normalized_path == '/proc' or normalized_path.startswith('/proc/')
@staticmethod
def open_text_file(path_string: str) -> str:
with open(path_string, 'r') as f:
return f.read()
def run_user_command(self) -> None:
"""
Use subprocess to run the user's command.
Updates magic_stdout, magic_stderr, and magic_returncode.
"""
if self.magic_run_command:
proc = subprocess.Popen(
self.magic_run_command,