app/testpmd: avoid exit without terminal restore
authorDapeng Yu <dapengx.yu@intel.com>
Mon, 25 Jan 2021 03:29:53 +0000 (11:29 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:12 +0000 (18:16 +0100)
commitb3e3d602a5ff6b91dd6006328b95e78ccd513f20
tree8211aed863a36f175309e8d09428cd7509a1853c
parent6c02043e9967a9d8f6e8c058256e257efe1d6d1a
app/testpmd: avoid exit without terminal restore

In interactive mode, if testpmd exit by calling rte_exit without
restore terminal attributes, terminal will not echo keyboard input.

register a function with atexit() in prompt(), when exit() in
rte_exit() is called, the registered function restores terminal
attributes.

Fixes: 5a8fb55c48ab ("app/testpmd: support unidirectional configuration")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
app/test-pmd/cmdline.c