Skip to content

Instantly share code, notes, and snippets.

@atucom
Created February 18, 2020 18:13
Show Gist options
  • Save atucom/840e1723ebb42166492c9c5c98eab54e to your computer and use it in GitHub Desktop.
Save atucom/840e1723ebb42166492c9c5c98eab54e to your computer and use it in GitHub Desktop.
Holds onto stdin for specified number of seconds (or default 2) and then pipes to stdout.
#!/usr/bin/env python3
# takes stdin, sleeps, outputs to stdout
import sys
import time
def main():
if len(sys.argv) > 1:
sleep_time = int(sys.argv[1])
else:
sleep_time = 2
time.sleep(sleep_time)
print(sys.stdin.read(), end="")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment