help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help fixing NativeMessaging host: read 32-bit message length in nati


From: Greg Wooledge
Subject: Re: Help fixing NativeMessaging host: read 32-bit message length in native byte order
Date: Sat, 24 Jun 2023 19:27:20 -0400

On Sat, Jun 24, 2023 at 03:32:10PM -0700, guest271314 wrote:
> #!/bin/bash
> getMessage() {
>   length=$(head -q -z --bytes=4 -| od -An -td4 -)
>   message=$(head -q -z --bytes=$((length)) -)
>   sendMessage "$message"
> }

Does that actually work?  In my experience, head(1) reads a buffer
full of input, even if it's only going to print a single line.  But
maybe the GNU version acts differently when given the --bytes argument?
If so, either congratulations are in order on your detective work,
or else you got lucky.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]