Commit 14dc98bc authored by Anael Beutot's avatar Anael Beutot
Browse files

Handle common cases for execute_command handler

command not found/command doesn't have executable permission
parent 0f56e66f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -297,6 +297,12 @@ class Handler(BasePlugin):
        self.commands.remove(remote_command)

        if remote_command.returncode != 0:
            # 127 means command not found, 126 means not executable
            if remote_command.returncode == 127:
                raise RemoteExecutionError('Command not found: %s' % stdout)
            elif remote_command.returncode == 126:
                raise RemoteExecutionError('Command is not executable')

            raise RemoteExecutionError('Child exited with non zero status %s' %
                                       remote_command.returncode)
        return stdout