DeadManMoving wrote:
Hi list,
i've been bashing my head on this one for a long time so i'd like to know if someone could give me an hint on it.
I'm writing a script to control how i use udpcast to install my machines. My problem is that when i try to use "read" (bash builtin), right after udp-sender complete his transfer (Transfer complete. Disconnecting ...), "read" cannot read from the keyboard and i'm having this error :
read: read error: 0: Resource temporarily unavailable
I even try to write my script in perl but "chomp" fail at the same place...
I'm pretty sure that it is a File Descriptor problem but don't know how to solve it. I think the relevant udpcast code is in console.c but i'm not a C programmer so i don't understand very well how things or going out in this file.
Thanks a lot!
Tony
I just tried this, both with an udp-sender running on the host system, and in the embedded system. In both cases, it worked as expected. In order to check what happens if it can't restore the console to a working state, I also tried, in both cases (embedded and server), to kill -9 udp-sender while it was waiting for the start signal. It did even work in that case (although the user's input was not echo'ed by the tty in that case, the shell still got it all right).
Here are the scripts I used for testing:
On server:
#!/bin/sh
udp-sender -f /bin/ls echo Shell read read a echo Got $a
In the embedded system (installed as a post script):
#!/bin/sh
read a echo Got $a
On a third machine, I had an udp-receiver running for the test.
In all 4 cases, it worked (embedded/success, embedded/kill-9, server/success, server/kill-9)
Could you supply details of your script and environment where it fails?
Thanks,
Alain