Skip to content

Commit f82c364

Browse files
committed
reenable emulate_tty by default
Signed-off-by: William Woodall <william@osrfoundation.org>
1 parent 0f81d98 commit f82c364

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

launch/launch/actions/execute_process.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
'sigterm_timeout', default=5),
9797
sigkill_timeout: SomeSubstitutionsType = LaunchConfiguration(
9898
'sigkill_timeout', default=5),
99-
emulate_tty: bool = False,
99+
emulate_tty: bool = True,
100100
prefix: Optional[SomeSubstitutionsType] = None,
101101
output: Text = 'log',
102102
output_format: Text = '[{this.name}] {line}',
@@ -175,7 +175,7 @@ def __init__(
175175
as a string or a list of strings and Substitutions to be resolved
176176
at runtime, defaults to the LaunchConfiguration called
177177
'sigkill_timeout'
178-
:param: emulate_tty emulate a tty (terminal), defaults to False, but can
178+
:param: emulate_tty emulate a tty (terminal), defaults to True, but can
179179
be overridden with the LaunchConfiguration called 'emulate_tty',
180180
the value of which is evaluated as true or false according to
181181
:py:func:`evaluate_condition_expression`.
@@ -345,6 +345,8 @@ def __on_signal_process_event(
345345
raise RuntimeError('Signal event received before execution.')
346346
if self._subprocess_transport is None:
347347
raise RuntimeError('Signal event received before subprocess transport available.')
348+
if self._subprocess_protocol is None:
349+
raise RuntimeError('Signal event received before subprocess protocol available.')
348350
if self._subprocess_protocol.complete.done():
349351
# the process is done or is cleaning up, no need to signal
350352
self.__logger.debug(
@@ -390,6 +392,8 @@ def __on_process_stdin(
390392
def __on_process_stdout(
391393
self, event: ProcessIO
392394
) -> Optional[SomeActionsType]:
395+
if self.__stdout_buffer.closed:
396+
raise RuntimeError('OnProcessIO (stdout) received after stdout buffer closed.')
393397
self.__stdout_buffer.write(event.text.decode(errors='replace'))
394398
self.__stdout_buffer.seek(0)
395399
last_line = None
@@ -409,6 +413,8 @@ def __on_process_stdout(
409413
def __on_process_stderr(
410414
self, event: ProcessIO
411415
) -> Optional[SomeActionsType]:
416+
if self.__stderr_buffer.closed:
417+
raise RuntimeError('OnProcessIO (stderr) received after stderr buffer closed.')
412418
self.__stderr_buffer.write(event.text.decode(errors='replace'))
413419
self.__stderr_buffer.seek(0)
414420
last_line = None

launch/test/launch/actions/test_emulate_tty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def tty_expected_unless_windows():
3636

3737
@pytest.mark.parametrize('test_input,expected', [
3838
# use the default defined by ExecuteProcess
39-
(None, not tty_expected_unless_windows()),
39+
(None, tty_expected_unless_windows()),
4040
# redundantly override the default via LaunchConfiguration
4141
('true', tty_expected_unless_windows()),
4242
# override the default via LaunchConfiguration

launch_testing/launch_testing/test_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def __init__(self,
5959
self._test_tr = threading.Thread(
6060
target=self._run_test,
6161
name='test_runner_thread',
62-
daemon=True
6362
)
6463

6564
def run(self):
@@ -160,6 +159,9 @@ def run(self):
160159

161160
self._results.append(inactive_results)
162161

162+
# Join the test thread before returning to avoid it being daemonized.
163+
self._test_tr.join()
164+
163165
return self._results
164166

165167
def _run_test(self):

0 commit comments

Comments
 (0)