Skip to content

Commit d469612

Browse files
committed
conditionally set the shlex.split() mode for Windows
Signed-off-by: William Woodall <[email protected]>
1 parent 9d5231e commit d469612

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

launch/launch/actions/execute_local.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
from ..utilities.type_utils import normalize_typed_substitution
7575
from ..utilities.type_utils import perform_typed_substitution
7676

77+
g_is_windows = 'win' in platform.system().lower()
78+
7779

7880
class ExecuteLocal(Action):
7981
"""Action that begins executing a process on the local system and sets up event handlers."""
@@ -357,7 +359,7 @@ def __on_signal_process_event(
357359
typed_event.signal_name, self.process_details['name']),
358360
)
359361
return None
360-
if platform.system() == 'Windows' and typed_event.signal_name == 'SIGINT':
362+
if g_is_windows and typed_event.signal_name == 'SIGINT':
361363
# TODO(wjwwood): remove this when/if SIGINT is fixed on Windows
362364
self.__logger.warning(
363365
"'SIGINT' sent to process[{}] not supported on Windows, escalating to 'SIGTERM'"
@@ -757,7 +759,7 @@ def execute(self, context: LaunchContext) -> Optional[List[LaunchDescriptionEnti
757759
expanded_cmd = []
758760
assert self.__process_event_args is not None
759761
for token in self.__process_event_args['cmd']:
760-
expanded_cmd.extend(shlex.split(token))
762+
expanded_cmd.extend(shlex.split(token), posix=g_is_windows)
761763
# Also update self.__process_event_args['cmd'] so it reflects the splitting.
762764
self.__process_event_args['cmd'] = expanded_cmd
763765
context.asyncio_loop.create_task(self.__execute_process(context))

0 commit comments

Comments
 (0)