Skip to content

Commit

Permalink
do not parse stderr to get correct routing stack (#1398)
Browse files Browse the repository at this point in the history
ignore the message printed on stderr

sonic:$ show ip bgp sum
usermod: Permission denied.
usermod: cannot lock /etc/passwd; try again later.
usermod: Permission denied.
usermod: cannot lock /etc/passwd; try again later.

Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan authored Feb 3, 2021
1 parent aa7b90e commit ba68aed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def get_routing_stack():
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
shell=True,
text=True,
stderr=subprocess.STDOUT)
text=True)
stdout = proc.communicate()[0]
proc.wait()
result = stdout.rstrip('\n')
Expand Down
3 changes: 1 addition & 2 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def get_routing_stack():
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
shell=True,
text=True,
stderr=subprocess.STDOUT)
text=True)
stdout = proc.communicate()[0]
proc.wait()
result = stdout.rstrip('\n')
Expand Down

0 comments on commit ba68aed

Please sign in to comment.