#!/usr/bin/env python
#

"""
If stdin is non-empty, run a specified command (and feed our stdin to its
stdin).

Usage: unless_empty command [args ...]
"""

import sys
import subprocess

inputdata = sys.stdin.read()

if inputdata:
    p = subprocess.Popen(sys.argv[1:], stdin=subprocess.PIPE)
    p.stdin.write(inputdata)

