Skip to content
Open
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
5 changes: 5 additions & 0 deletions launch/launch/actions/execute_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Module for the ExecuteLocal action."""

import sys
import asyncio
import io
import logging
Expand Down Expand Up @@ -566,6 +567,10 @@ async def __execute_process(self, context: LaunchContext) -> None:
)

try:
# On Windows, Python scripts cannot be passed directly to CreateProcess().
# Invoke them through the Python interpreter, matching ros2run behavior.
if os.name == 'nt' and cmd and cmd[0].lower().endswith('.py'):
cmd.insert(0, sys.executable)
transport, self._subprocess_protocol = await async_execute_process(
lambda **kwargs: self.__ProcessProtocol(
self, context, process_event_args, **kwargs
Expand Down