From 1234494e7711137755be9d738654352d2ad57497 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 24 May 2015 16:53:58 +0300 Subject: [PATCH] uavcan_dynamic_node_id_server will not run if stdout is not a tty --- .../linux/apps/uavcan_dynamic_node_id_server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libuavcan_drivers/linux/apps/uavcan_dynamic_node_id_server.cpp b/libuavcan_drivers/linux/apps/uavcan_dynamic_node_id_server.cpp index a922230892..6545ed2d30 100644 --- a/libuavcan_drivers/linux/apps/uavcan_dynamic_node_id_server.cpp +++ b/libuavcan_drivers/linux/apps/uavcan_dynamic_node_id_server.cpp @@ -618,6 +618,12 @@ int main(int argc, const char** argv) { try { + if (isatty(STDOUT_FILENO) != 1) + { + std::cerr << "This application cannot run if stdout is not associated with a terminal" << std::endl; + std::exit(1); + } + auto options = parseOptions(argc, argv); std::cout << "Self node ID: " << int(options.node_id.get()) << "\n"