Skip to content

Commit 9463b2e

Browse files
committed
code refactoring
1 parent 6981cd1 commit 9463b2e

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

libnmap/process.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,12 @@ def run(self):
262262
raise EnvironmentError(1, "nmap is not installed or could "
263263
"not be found in system path")
264264

265-
thread_stream = ''
266265
while self.__nmap_proc.poll() is None:
267-
for streamline in iter(self.__nmap_proc.stdout.readline, b''):
268-
if streamline is not None:
269-
thread_stream = str(streamline.decode())
270-
self.__stdout += thread_stream
271-
evnt = self.__process_event(thread_stream)
272-
if self.__nmap_event_callback and evnt:
273-
self.__nmap_event_callback(self)
266+
for streamline in iter(self.__nmap_proc.stdout.readline, ''):
267+
self.__stdout += streamline
268+
evnt = self.__process_event(streamline)
269+
if self.__nmap_event_callback and evnt:
270+
self.__nmap_event_callback(self)
274271

275272
self.__stderr += str(self.__nmap_proc.stderr.read().decode())
276273

0 commit comments

Comments
 (0)