tps: add proof of concept for --yes option

Needs to have a special version of raw_input to
correctly respond to EOF
parent 316248bb
#! /user/dcobas/2.7.1/bin/python
# coding: utf8
import sys
if __name__ == '__main__':
input = sys.stdin
x = raw_input('Dime algo')
print 'x = [{0}]'.format(x)
try:
sys.stdin = file('/dev/null')
x = raw_input('Dime algo')
print 'x = [{0}]'.format(x)
except EOFError:
print 'found EOF when reading from redirected stdin'
sys.stdin = input
x = raw_input('Dime algo')
print 'x = [{0}]'.format(x)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment