File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ def run_cli(args=None):
8282    except  KafkaError  as  e :
8383        logger .error (e )
8484        return  1 
85-     except  Exception   as   e :
85+     except  Exception :
8686        logger .exception ('Error!' )
8787        return  1 
8888    finally :
Original file line number Diff line number Diff line change 22
33import  argparse 
44import  logging 
5+ import  sys 
56
67from  kafka  import  KafkaProducer 
78
@@ -73,7 +74,12 @@ def log_result(res_or_err):
7374
7475    try :
7576        while  True :
76-             value  =  input_py23 ()
77+             try :
78+                 value  =  input_py23 ()
79+             except  EOFError :
80+                 value  =  sys .stdin .read ().rstrip ('\n ' )
81+                 if  not  value :
82+                     return  0 
7783            producer .send (config .topic , value = value .encode (config .encoding )).add_both (log_result )
7884    except  KeyboardInterrupt :
7985        logger .info ('Bye!' )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments