Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rosmon_core/src/monitor/node_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ std::pair<int,int> NodeMonitor::createPTY()
if(openpty(&master, &slave, nullptr, nullptr, nullptr) == -1)
throw error("Could not open pseudo terminal for child process: {}", strerror(errno));

// Mark master as close-on-exec so it is not inherited by child processes
if(fcntl(master, F_SETFD, FD_CLOEXEC) == -1)
throw error("Could not set close-on-exec flag for PTY master: {}", strerror(errno));

// On Linux, a new unix98 pty is initialized with the output flag ONLCR set,
// which converts \n to \r\n
// Disable this bahavior by clearing the flag
Expand Down