summaryrefslogtreecommitdiff
path: root/src/op_mode/interfaces.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-01-29 13:45:29 -0600
committerGitHub <noreply@github.com>2026-01-29 13:45:29 -0600
commit1af4e423a17064e3e6d87b0c5df1c01688b6551a (patch)
treead9af31411eb033c32c47659461856c46bbfa3e8 /src/op_mode/interfaces.py
parent8944d5e4aea06e0c501880204c49a32494df8966 (diff)
parentbe6607c66e3414e3549d9568bb6840eee6f801be (diff)
downloadvyos-1x-1af4e423a17064e3e6d87b0c5df1c01688b6551a.tar.gz
vyos-1x-1af4e423a17064e3e6d87b0c5df1c01688b6551a.zip
Merge pull request #4951 from c-po/broken-pipe
op-mode: T8154: fix tcpdump KeyboardInterrupt on Ctrl+C
Diffstat (limited to 'src/op_mode/interfaces.py')
-rwxr-xr-xsrc/op_mode/interfaces.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/op_mode/interfaces.py b/src/op_mode/interfaces.py
index ed36731e3..ecc4e73d2 100755
--- a/src/op_mode/interfaces.py
+++ b/src/op_mode/interfaces.py
@@ -13,9 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-import os
import re
import sys
import glob
@@ -30,6 +28,7 @@ from vyos.ifconfig import Section
from vyos.ifconfig import Interface
from vyos.ifconfig import VRRP
from vyos.utils.dict import dict_set_nested
+from vyos.utils.io import catch_broken_pipe
from vyos.utils.network import get_interface_vrf
from vyos.utils.network import interface_exists
from vyos.utils.process import cmd
@@ -37,15 +36,6 @@ from vyos.utils.process import rc_cmd
from vyos.utils.process import call
from vyos.configquery import op_mode_config_dict
-def catch_broken_pipe(func):
- def wrapped(*args, **kwargs):
- try:
- func(*args, **kwargs)
- except (BrokenPipeError, KeyboardInterrupt):
- # Flush output to /dev/null and bail out.
- os.dup2(os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno()) # pylint: disable = no-member
- return wrapped
-
# The original implementation of filtered_interfaces has signature:
# (ifnames: list, iftypes: typing.Union[str, list], vif: bool, vrrp: bool) -> intf: Interface:
# Arg types allowed in CLI (ifnames: str, iftypes: str) were manually