in src/aws_encryption_sdk_cli/__init__.py [0:0]
def _catch_bad_stdin_stdout_requests(source, destination):
# type: (str, str) -> None
"""Catches bad requests based on characteristics of source and destination when
source might be stdin or stdout.
:param str source: Identifier for the source (filesystem path or ``-`` for stdin)
:param str destination: Identifier for the destination (filesystem path or ``-`` for stdout)
:raises BadUserArgument: if source and destination are the same
:raises BadUserArgument: if source is stdin and destination is a directory
"""
acting_as_pipe = destination == "-" and source == "-"
if not acting_as_pipe and os.path.realpath(source) == os.path.realpath(destination):
raise BadUserArgumentError("Destination and source cannot be the same")
if source == "-" and os.path.isdir(destination):
raise BadUserArgumentError("Destination may not be a directory when source is stdin")