Skip to content

Commit 2f72a52

Browse files
committed
Improve logging in command_runner and remove unused imports
1 parent d4ec5f0 commit 2f72a52

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

extensions/fine_python_pip/src/fine_python_pip/install_deps_in_env_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import dataclasses
32
import pathlib
43

finecode_extension_api/src/finecode_extension_api/interfaces/iactionrunner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from pathlib import Path
21
from typing import Any, Protocol
32

43

finecode_extension_runner/src/finecode_extension_runner/di/bootstrap.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import functools
22
import pathlib
3-
from typing import Any, Awaitable, Callable, Type, TypeVar
3+
from typing import Any, Awaitable, Callable
44

55
try:
66
import fine_python_ast
@@ -12,7 +12,6 @@
1212
except ImportError:
1313
fine_python_mypy = None
1414

15-
from finecode_extension_api import code_action
1615
from finecode_extension_api.interfaces import (
1716
iactionrunner,
1817
icache,

finecode_extension_runner/src/finecode_extension_runner/impls/action_runner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from pathlib import Path
2-
from typing import Any, TypeAlias
1+
from typing import Any
32

43
from finecode_extension_api.interfaces import iactionrunner
54

finecode_extension_runner/src/finecode_extension_runner/impls/command_runner.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def __init__(self, logger: ilogger.ILogger):
100100
async def run(
101101
self, cmd: str, cwd: Path | None = None, env: dict[str, str] | None = None
102102
) -> icommandrunner.IAsyncProcess:
103-
self.logger.debug(f"Async subprocess run: {cmd} in {cwd}")
103+
log_msg = f"Async subprocess run: {cmd}"
104+
if cwd is not None:
105+
log_msg += f" in {cwd}"
106+
self.logger.debug(log_msg)
104107
# TODO: investigate why it works only with shell, not exec
105108
async_subprocess = await asyncio.create_subprocess_shell(
106109
cmd,
@@ -116,7 +119,10 @@ def run_sync(
116119
self, cmd: str, cwd: Path | None = None, env: dict[str, str] | None = None
117120
) -> icommandrunner.ISyncProcess:
118121
cmd_parts = shlex.split(cmd)
119-
self.logger.debug(f"Sync subprocess run: {cmd_parts}")
122+
log_msg = f"Sync subprocess run: {cmd_parts}"
123+
if cwd is not None:
124+
log_msg += f' {cwd}'
125+
self.logger.debug(log_msg)
120126
async_subprocess = subprocess.Popen(
121127
cmd_parts,
122128
stdin=subprocess.PIPE,

0 commit comments

Comments
 (0)