Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion poethepoet/executor/poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ async def execute(
return await self._execute_cmd(cmd, input=input, use_exec=use_exec)

# Run this task with `poetry run`
return await self._execute_cmd(
result = await self._execute_cmd(
(self._poetry_cmd(), "--no-plugins", "run", *cmd),
input=input,
use_exec=use_exec,
)
# The inner cmd may be a .bat/.cmd but _exec_via_subproc only sees
# poetry.exe as cmd[0], so check the original command here
if self._is_windows and cmd[0].lower().endswith((".bat", ".cmd")):
result.no_console_ctrl = True
return result

async def _handle_file_not_found(
self, cmd: Sequence[str], error: FileNotFoundError
Expand Down
7 changes: 6 additions & 1 deletion poethepoet/executor/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ async def execute(
)

# Run this task with `uv run`
return await self._execute_cmd(
result = await self._execute_cmd(
(self._uv_cmd(), "run", *uv_run_options, *cmd),
input=input,
use_exec=use_exec,
)
# The inner cmd may be a .bat/.cmd but _exec_via_subproc only sees uv.exe
# as cmd[0], so check the original command here
if self._is_windows and cmd[0].lower().endswith((".bat", ".cmd")):
result.no_console_ctrl = True
return result

@classmethod
def _uv_cmd(cls):
Expand Down
6 changes: 3 additions & 3 deletions poethepoet/shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _initialize_shutdown(self):
self._shutdown_loop(), name="ShutdownWorker"
)

async def _shutdown_loop(self, escalation_interval_s: float = 1.0):
async def _shutdown_loop(self, escalation_interval_s: float = 0.8):
"""
Call shutdown again every interval_s seconds until everything is dead
"""
Expand All @@ -64,12 +64,12 @@ def _shutdown(self):
if proc.returncode is None:
if proc.no_console_ctrl:
self._io.print_debug(
" ! Terminating subprocess tree %s"
" ! Force-terminating subprocess tree %s"
" to avoid console corruption",
proc.pid,
)
subprocess.run(
["taskkill", "/T", "/PID", str(proc.pid)],
["taskkill", "/F", "/T", "/PID", str(proc.pid)],
capture_output=True,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fake_taskkill(cmd: list[str], **_kwargs):
manager._shutdown()

assert fake_proc.signal_calls == []
assert taskkill_calls == [["taskkill", "/T", "/PID", str(process.pid)]]
assert taskkill_calls == [["taskkill", "/F", "/T", "/PID", str(process.pid)]]
loop.close()


Expand Down
Loading