mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-10-06 09:02:52 +08:00
Queue unwritten stdin instead of dropping it when a request is larger than the pipe can take at once, and drain the queue without blocking the CAN work queue. Only stdin needs to stay nonblocking (it's written from that work queue); stdout reads stay blocking, gated on FIONREAD, like the mavlink shell already does. Report a shell session that has exited as an explicit error instead of silently swallowing EPIPE and returning empty output. Surface that error in the Python client as well. Flush the queued stdin on idle polls too, not just when new input arrives, since an idle poll is all the client sends while the user isn't typing. Only redirect fd 0/1 for the child once both stdio backups succeeded, so a dup() failure can't leave the node's own stdin/stdout pointing into the shell pipes. Distinguish EAGAIN (retry later) from EPIPE (never will succeed) when flushing queued stdin, so a dead shell doesn't hold the queue forever refusing new input. Only compile the shell sources when CONFIG_UAVCANNODE_COMMAND_SHELL is enabled, matching how every other optional uavcannode feature is gated, instead of pulling nshlib into every board's image. Detect a dead shell task with nxsched_get_tcb(), the same lookup top/cpuload.cpp use, instead of a POSIX-only helper with no NuttX implementation. Fix GetNodeInfo name decoding in the client to tolerate non-UTF-8 bytes instead of crashing the scan. Signed-off-by: danielbuleandra <daniel.buleandra@auterion.com>