'Map' object is not accountable

It's needed to perform a 'list' transformation before doing a count of the 'map' object.
This commit is contained in:
Daniel Alonso 2021-02-20 20:52:44 +01:00 committed by GitHub
parent a9b8c9bb39
commit 73721fe8ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,8 +11,8 @@ class Segment(ThreadedSegment):
if platform.system().startswith('CYGWIN'):
# cygwin ps is a special snowflake...
output_proc = subprocess.Popen(['ps', '-af'], stdout=subprocess.PIPE)
output = map(lambda l: int(l.split()[2].strip()),
output_proc.communicate()[0].decode("utf-8").splitlines()[1:])
output = list(map(lambda l: int(l.split()[2].strip()),
output_proc.communicate()[0].decode("utf-8").splitlines()[1:]))
self.num_jobs = output.count(os.getppid()) - 1
else:
pppid_proc = subprocess.Popen(['ps', '-p', str(os.getppid()), '-oppid='],