Skip to content

[Execute Shell Command] Fix return type inconsistency and print formatting bug #463

Description

@Prayas340

Description

In Execute Shell Command/execute_shell_command.py:

  1. When an exception occurs during shell command execution, execute_shell_command(command) returns a single integer (105) instead of a tuple (bytes, int). Callers unpacking result, status = execute_shell_command(command) crash with TypeError: cannot unpack non-iterable int object.
  2. Line 14 uses comma-separated formatting print("Exception Occurred while executing module : %s", str(err)), which prints the formatting string literally instead of substituting %s.
  3. execute_shell_command_test.py lacks coverage for failed commands.

Proposed Fix

  • Update return statement in except block to return (b'', 105).
  • Use f-string formatting for exception printing.
  • Add unit test for failed execution in execute_shell_command_test.py.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions