Skip to content

Commit

Permalink
Fix forward_null Coverity issue in pexpect.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DenitsaTH authored and AaronAtDuo committed Oct 21, 2024
1 parent ab4361b commit 56a3004
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/pexpect.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,19 @@ def print_ticks(d):
child_result_list.append(child.before + child.after)
else: # child.after may have been a TIMEOUT or EOF, so don't cat those.
child_result_list.append(child.before)
if type(responses[index]) is str:
child.send(responses[index])
elif isinstance(responses[index], types.FunctionType):
callback_result = responses[index](locals())
sys.stdout.flush()
if type(callback_result) is str:
child.send(callback_result)
elif callback_result:
break
else:
raise TypeError("The callback must be a string or function type.")
event_count = event_count + 1
if responses is not None:
if type(responses[index]) is str:
child.send(responses[index])
elif isinstance(responses[index], types.FunctionType):
callback_result = responses[index](locals())
sys.stdout.flush()
if type(callback_result) is str:
child.send(callback_result)
elif callback_result:
break
else:
raise TypeError("The callback must be a string or function type.")
event_count = event_count + 1
except TIMEOUT as e:
child_result_list.append(child.before)
break
Expand Down

0 comments on commit 56a3004

Please sign in to comment.