Skip to content

Commit

Permalink
Merge pull request #111 from rxwen/fix_race_condition_in_getpid
Browse files Browse the repository at this point in the history
Fix bug: may fail to get target pid
  • Loading branch information
JakeWharton committed Sep 18, 2015
2 parents 0ef40cc + 04ca2bd commit a6815e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pidcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def tag_in_tags_regex(tag, tags):

ps_command = base_adb_command + ['shell', 'ps']
ps_pid = subprocess.Popen(ps_command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
while ps_pid.poll() is None:
while True:
try:
line = ps_pid.stdout.readline().decode('utf-8', 'replace').strip()
except KeyboardInterrupt:
Expand Down

0 comments on commit a6815e9

Please sign in to comment.