zhhyu7 opened a new pull request, #4203:
URL: https://github.com/apache/nuttx-apps/pull/4203

   ## Summary
   
   do_rexec() relays stdin to the socket and the socket to stdout in one
   poll() loop.  It left the loop as soon as stdin returned EOF, so with
   "echo | rexec ..." or any pipe on stdin it exited before the remote
   command had produced its output.  Stop polling stdin on EOF and keep
   waiting for the socket; leave the loop when the socket hangs up, and
   return 0 in that case instead of a stale error code.
   
   ## Impact
   
   - rexec client only.  Interactive use is unchanged.
   
   ## Testing
   
   im:dynconns + CONFIG_NETUTILS_REXEC on the nuttx0 bridge.  A small
   rexecd on the host (port 5512) prints three lines 0.7 s apart.
   
   This branch:
   
   ```
   rexec -H 10.0.1.1 -P 5512 -u u -p p remote_cmd_a
   rexecd: from ('10.0.1.2', 29378) cmd=b'remote_cmd_a '
   line 0 of b'remote_cmd_a '
   line 1 of b'remote_cmd_a '
   line 2 of b'remote_cmd_a '
   nsh> echo | rexec -H 10.0.1.1 -P 5512 -u u -p p remote_cmd_b
   sh [9:100]
   rexecd: from ('10.0.1.2', 29379) cmd=b'remote_cmd_b '
   line 0 of b'remote_cmd_b '
   line 1 of b'remote_cmd_b '
   line 2 of b'remote_cmd_b '
   ```
   
   apache/master: with a pipe on stdin rexec returns immediately and the
   server gets EPIPE.
   
   ```
   nsh> echo | rexec -H 10.0.1.1 -P 5512 -u u -p p remote_cmd_b
   sh [9:100]
   rexecd: from ('10.0.1.2', 6240) cmd=b'remote_cmd_b '
   nsh>
   (host rexecd) BrokenPipeError: [Errno 32] Broken pipe
   ```
   
   checkpatch.sh -c -u -m -g passes for every commit.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to