Log a nicer error message when failing to read cwd of a process

This commit is contained in:
Kovid Goyal 2021-12-22 16:22:33 +05:30
parent ee166c5555
commit 70d5a5134f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -12,9 +12,9 @@ from typing import (
import kitty.fast_data_types as fast_data_types import kitty.fast_data_types as fast_data_types
from .utils import which
from .constants import is_macos, kitty_base_dir, shell_path, terminfo_dir from .constants import is_macos, kitty_base_dir, shell_path, terminfo_dir
from .types import run_once from .types import run_once
from .utils import log_error, which
try: try:
from typing import TypedDict from typing import TypedDict
@ -200,9 +200,8 @@ class Child:
if cwd_from is not None: if cwd_from is not None:
try: try:
cwd = cwd_of_process(cwd_from) cwd = cwd_of_process(cwd_from)
except Exception: except Exception as err:
import traceback log_error(f'Failed to read cwd of {cwd_from} with error: {err}')
traceback.print_exc()
else: else:
cwd = os.path.expandvars(os.path.expanduser(cwd or os.getcwd())) cwd = os.path.expandvars(os.path.expanduser(cwd or os.getcwd()))
self.cwd = os.path.abspath(cwd) self.cwd = os.path.abspath(cwd)