diff --git a/build-deb/debian/changelog b/build-deb/debian/changelog index ca256a1..29fbc9f 100644 --- a/build-deb/debian/changelog +++ b/build-deb/debian/changelog @@ -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 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. diff --git a/bundle.json b/bundle.json index 11b3ce6..af0dcdb 100644 --- a/bundle.json +++ b/bundle.json @@ -1,6 +1,6 @@ { "name": "route", - "version": "0.9.5", + "version": "0.9.6", "author": "Aeluin Chen", "email": "aeluin.chen@moxa.com", "description": "Handle the routing table", diff --git a/ip/addr.py b/ip/addr.py index cde5f6a..9684e9c 100755 --- a/ip/addr.py +++ b/ip/addr.py @@ -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: @@ -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):