Skip to content

Commit

Permalink
Merge pull request #20 from lwindg/develop
Browse files Browse the repository at this point in the history
Add timeout to `grep`
  • Loading branch information
imZack committed Nov 5, 2015
2 parents 9b5c4fb + 3f4d594 commit 2646039
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions build-deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
sanji-bundle-route (0.9.6-1) unstable; urgency=low

* Add timeout to `grep` for preventing input without EOF.

-- Aeluin Chen <[email protected]> Thu, 05 Nov 2015 11:22:22 +0800

sanji-bundle-route (0.9.5-1) unstable; urgency=low

* Bugfix: default gateway cannot be updated at some scenario.
Expand Down
2 changes: 1 addition & 1 deletion bundle.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "route",
"version": "0.9.5",
"version": "0.9.6",
"author": "Aeluin Chen",
"email": "[email protected]",
"description": "Handle the routing table",
Expand Down
8 changes: 6 additions & 2 deletions ip/addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def ifupdown(iface, up):
if not up:
try:
output = sh.awk(
sh.grep(sh.grep(sh.ps("ax"), iface), "dhclient"),
sh.grep(
sh.grep(sh.ps("ax"), iface, _timeout=5),
"dhclient", _timeout=5),
"{print $1}")
dhclients = output().split()
for dhclient in dhclients:
Expand Down Expand Up @@ -150,7 +152,9 @@ def ifconfig(iface, dhcpc, ip="", netmask="24", gateway="", script=None):
# Disable the dhcp client and flush interface
try:
dhclients = sh.awk(
sh.grep(sh.grep(sh.ps("ax"), iface), "dhclient"),
sh.grep(
sh.grep(sh.ps("ax"), iface, _timeout=5),
"dhclient", _timeout=5),
"{print $1}")
dhclients = dhclients.split()
if 1 == len(dhclients):
Expand Down

0 comments on commit 2646039

Please sign in to comment.