# Buggy code
def _send_output_to_pager(self, output):
    cmdline = self.get_pager_cmdline()
    LOG.debug("Running command: %s", cmdline)
    with ignore_ctrl_c():
        # We can't rely on the KeyboardInterrupt from
        # the CLIDriver being caught because when we
        # send the output to a pager it will use various
        # control characters that need to be cleaned
        # up gracefully.  Otherwise if we simply catch
        # the Ctrl-C and exit, it will likely leave the
        # users terminals in a bad state and they'll need
        # to manually run ``reset`` to fix this issue.
        # Ignoring Ctrl-C solves this issue.  It's also
        # the default behavior of less (you can't ctrl-c
        # out of a manpage).
        p = self._popen(cmdline, stdin=PIPE)
        p.communicate(input=output)


# Traceback (OSError)
root@redacted:~# aws --debug help
2016-05-05 16:32:19,477 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.10.25 Python/2.7.9 Linux/4.4.5-15.26.amzn1.x86_64 botocore/1.4.16
2016-05-05 16:32:19,477 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['--debug', 'help']
2016-05-05 16:32:19,478 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x7f9faee85e60>
2016-05-05 16:32:19,478 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f9faee681b8>
2016-05-05 16:32:19,478 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set.
2016-05-05 16:32:19,479 - MainThread - botocore.hooks - DEBUG - Event doc-breadcrumbs.aws: calling handler <bound method ProviderDocumentEventHandler.doc_breadcrumbs of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,479 - MainThread - botocore.hooks - DEBUG - Event doc-title.aws: calling handler <bound method ProviderDocumentEventHandler.doc_title of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,479 - MainThread - botocore.hooks - DEBUG - Event doc-description.aws: calling handler <bound method ProviderDocumentEventHandler.doc_description of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,479 - MainThread - botocore.hooks - DEBUG - Event doc-description.aws: calling handler <function add_paging_description at 0x7f9faf01a5f0>
2016-05-05 16:32:19,480 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-start.aws: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_start of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,480 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.debug: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,480 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.endpoint-url: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,480 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.no-verify-ssl: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,480 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.no-paginate: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,481 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.output: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,481 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.query: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,481 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.profile: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,481 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.region: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,481 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.version: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,482 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.color: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,482 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.no-sign-request: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,482 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.ca-bundle: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,482 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.cli-read-timeout: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,482 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-option.aws.cli-connect-timeout: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,483 - MainThread - botocore.hooks - DEBUG - Event doc-synopsis-end.aws: calling handler <bound method ProviderDocumentEventHandler.doc_synopsis_end of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,483 - MainThread - botocore.hooks - DEBUG - Event doc-options-start.aws: calling handler <bound method ProviderDocumentEventHandler.doc_options_start of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,483 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.debug: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,483 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.endpoint-url: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,484 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.no-verify-ssl: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,484 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.no-paginate: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,484 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.output: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,485 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.query: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,485 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.profile: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,485 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.region: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,486 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.version: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,486 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.color: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,486 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.no-sign-request: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,487 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.ca-bundle: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,487 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.cli-read-timeout: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,487 - MainThread - botocore.hooks - DEBUG - Event doc-option.aws.cli-connect-timeout: calling handler <bound method ProviderDocumentEventHandler.doc_option of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,488 - MainThread - botocore.hooks - DEBUG - Event doc-subitems-start.aws: calling handler <bound method ProviderDocumentEventHandler.doc_subitems_start of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,488 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.acm: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,488 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.apigateway: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,488 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.autoscaling: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,489 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudformation: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,489 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudfront: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,489 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudhsm: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,489 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudsearch: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,489 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudsearchdomain: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,490 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudtrail: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,490 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cloudwatch: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,490 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.codecommit: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,490 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.codepipeline: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,490 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cognito-identity: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cognito-idp: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.cognito-sync: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.configservice: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.configure: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.datapipeline: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,491 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.deploy: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,492 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.devicefarm: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,492 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.directconnect: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,492 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.dms: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,492 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ds: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,493 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.dynamodb: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,493 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.dynamodbstreams: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,493 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ec2: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,493 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ecr: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,493 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ecs: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,494 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.efs: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,494 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.elasticache: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,494 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.elasticbeanstalk: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,494 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.elastictranscoder: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,494 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.elb: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,495 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.emr: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,495 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.es: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,495 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.events: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,495 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.firehose: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,495 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.gamelift: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,496 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.glacier: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,496 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.help: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,496 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.iam: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,496 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.importexport: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,496 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.inspector: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.iot: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.iot-data: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.kinesis: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.kms: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.lambda: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,497 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.logs: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,498 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.machinelearning: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,498 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.marketplacecommerceanalytics: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,498 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.meteringmarketplace: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,498 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.opsworks: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,499 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.rds: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,499 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.redshift: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,499 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.route53: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,499 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.route53domains: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,499 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.s3: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,500 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.s3api: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,500 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.sdb: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,500 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ses: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,500 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.sns: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,500 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.sqs: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,501 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.ssm: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,501 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.storagegateway: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,501 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.sts: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,501 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.support: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,501 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.swf: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,502 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.waf: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,502 - MainThread - botocore.hooks - DEBUG - Event doc-subitem.aws.workspaces: calling handler <bound method ProviderDocumentEventHandler.doc_subitem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,503 - MainThread - botocore.hooks - DEBUG - Event doc-relateditems-start.aws: calling handler <bound method ProviderDocumentEventHandler.doc_relateditems_start of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,503 - MainThread - botocore.hooks - DEBUG - Event doc-relateditem.aws.aws help topics: calling handler <bound method ProviderDocumentEventHandler.doc_relateditem of <awscli.clidocs.ProviderDocumentEventHandler object at 0x7f9fae9519d0>>
2016-05-05 16:32:19,566 - MainThread - awscli.help - DEBUG - Running command: ['groff', '-m', 'man', '-T', 'ascii']
2016-05-05 16:32:19,582 - MainThread - awscli.help - DEBUG - Running command: ['less', '-R']
2016-05-05 16:32:19,584 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 186, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 264, in __call__
self.renderer.render(self.doc.getvalue())
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 82, in render
self._send_output_to_pager(converted_content)
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 130, in _send_output_to_pager
p = self._popen(cmdline, stdin=PIPE)
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 91, in _popen
return Popen(*args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
2016-05-05 16:32:19,587 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

[Errno 2] No such file or directory

# Fixed code
def _send_output_to_pager(self, output):
    cmdline = self.get_pager_cmdline()
    if not self._exists_on_path(cmdline[0]):
        LOG.debug("Pager '%s' not found in PATH, printing raw help." % cmdline[0])
        self.output_stream.write(output.decode("utf-8") + "\n")
        self.output_stream.flush()
        return
    LOG.debug("Running command: %s", cmdline)
    with ignore_ctrl_c():
        # We can't rely on the KeyboardInterrupt from
        # the CLIDriver being caught because when we
        # send the output to a pager it will use various
        # control characters that need to be cleaned
        # up gracefully.  Otherwise if we simply catch
        # the Ctrl-C and exit, it will likely leave the
        # users terminals in a bad state and they'll need
        # to manually run ``reset`` to fix this issue.
        # Ignoring Ctrl-C solves this issue.  It's also
        # the default behavior of less (you can't ctrl-c
        # out of a manpage).
        p = self._popen(cmdline, stdin=PIPE)
        p.communicate(input=output)