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):
82
82
except KafkaError as e :
83
83
logger .error (e )
84
84
return 1
85
- except Exception as e :
85
+ except Exception :
86
86
logger .exception ('Error!' )
87
87
return 1
88
88
finally :
Original file line number Diff line number Diff line change 2
2
3
3
import argparse
4
4
import logging
5
+ import sys
5
6
6
7
from kafka import KafkaProducer
7
8
@@ -73,7 +74,12 @@ def log_result(res_or_err):
73
74
74
75
try :
75
76
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
77
83
producer .send (config .topic , value = value .encode (config .encoding )).add_both (log_result )
78
84
except KeyboardInterrupt :
79
85
logger .info ('Bye!' )
You can’t perform that action at this time.
0 commit comments