#!/usr/bin/env bash

url=$1
s3_url=$2

echo -n .
curl --fail --no-progress-meter --show-error $url | aws s3 cp - $s3_url

if [ ${PIPESTATUS[0]} != 0 -o ${PIPESTATUS[1]} != 0 ] ; then
  # from xargs man page:
  #     If any invocation of the command exits with a status of 255,
  #       xargs will stop immediately without reading any further input.
  exit 255
fi
