<s> import sys , os , logging , traceback , subprocess , platform <EOL> import asyncoro <EOL> import asyncoro . asyncfile <EOL> def communicate ( input , coro = None ) : <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> pipe = asyncoro . asyncfile . Popen ( [ r'<STR_LIT>' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) <EOL> else : <EOL> pipe = subprocess . Popen ( [ '<STR_LIT>' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) <EOL> async_pipe = asyncoro . asyncfile . AsyncPipe ( pipe ) <EOL> input = open ( input ) <EOL> stdout , stderr = yield async_pipe . communicate ( input ) <EOL> print ( '<STR_LIT>' % stdout ) <EOL> def custom_feeder ( input , coro = None ) : <EOL> def write_proc ( fin , pipe , coro = None ) : <EOL> while True : <EOL> data = yield os . read ( fin . fileno ( ) , <NUM_LIT:8> * <NUM_LIT> ) <EOL> if not data : <EOL> break <EOL> n = yield pipe . write ( data , full = True ) <EOL> assert n == len ( data ) <EOL> fin . close ( ) <EOL> pipe . stdin . close ( ) <EOL> def read_proc ( pipe , coro = None ) : <EOL> data = yield pipe . stdout . read ( ) <EOL> pipe . stdout . close ( ) <EOL> raise StopIteration ( data ) <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> pipe = asyncoro . asyncfile . Popen ( [ r'<STR_LIT>' ] , <EOL> stdin = subprocess . PIPE , stdout = subprocess . PIPE ) <EOL> else : <EOL> pipe = subprocess . Popen ( [ '<STR_LIT>' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) <EOL> async_pipe = asyncoro . asyncfile . AsyncPipe ( pipe ) <EOL> reader = asyncoro . Coro ( read_proc , async_pipe ) <EOL> writer = asyncoro . Coro ( write_proc , open ( input ) , async_pipe ) <EOL> stdout = yield reader . finish ( ) <EOL> print ( '<STR_LIT>' % stdout ) <EOL> coro = asyncoro . Coro ( communicate , sys . argv [ <NUM_LIT:1> ] if len ( sys . argv ) > <NUM_LIT:1> else sys . argv [ <NUM_LIT:0> ] ) <EOL> coro . value ( ) <EOL> asyncoro . Coro ( custom_feeder , sys . argv [ <NUM_LIT:1> ] if len ( sys . argv ) > <NUM_LIT:1> else sys . argv [ <NUM_LIT:0> ] ) </s>
