remove repeated code in Cmd readbytes()
fix #4150