Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Tesing a fifo without opening it?
- X-seq: zsh-users 15385
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: Dominik Vogt <dominik.vogt@xxxxxx>
- Subject: Re: Tesing a fifo without opening it?
- Date: Fri, 10 Sep 2010 12:36:32 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1284118592; bh=fhDoxRzMObXciNu3JZiuCgepzErG0NMRFBOB6ssQip0=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=TkwiMwLgvOpMN5q/ShWiWcS3iFHDMrCxBlTp87+752ubmwqOwHBCVEQw+TV+EI8pClDoGYEhKZi2Eunw6ajKxFcOzj45NVKUplS+XJNaHgSCLw0JA9yAp3xiL5fyZSxvd09I/bja63EZggA5csFIQFNMeGmIubbq9oWaDnL89iE=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=Mk8hFvpWqRGpyT5xOCA9EbHKuyms3DfqFdM8yZhge05R6PTZz4EpaI1i48q4vg6FamKkWHMJo8eiHMo0F3hCpxvtYiv3Ph2hbIw0P3unxWzOxTW9UZx0VJbjRK6IepdL3ZLpVz3BqlWAHZLi4sJYC+dsn+5gmxBki3e3iosQig4= ;
- In-reply-to: <20100910063544.45240@xxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: Dominik Vogt <dominik.vogt@xxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100910063544.45240@xxxxxxx>
2010-09-10 08:35:44 +0200, Dominik Vogt:
[...]
> 05 if read -t REQUEST < "$1"; then
[...]
> Now, the problem is that input redirection in line 5 blocks
> until the main script also opens the fifo. So the -t flag of
> read does not "work" here (because read is not even executed
> until the fifo can be opened). I want to check if data is
> available in the fifo without blocking, but I can't find a way
> around blocking in the input redirection.
[...]
On Linux (at least, though the behavior is not clearly defined
by POSIX)
read -t REQUEST <> "$1"
should work.
Otherwise, other approaches: open with O_NONBLOCK (though you'd
need to do it in something else as I don't think zsh has an
interface to open with O_NONBLOCK).
Or you could do
: > "$1" & read...
though it would have other side effects.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author