LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-22-2003, 01:12 PM   #1
droussel
LQ Newbie
 
Registered: May 2003
Distribution: SuSe, Gentoo
Posts: 2

Rep: Reputation: 0
Non-blocking write to a fifo


Hi,

I'm fairly new to bash scripting being mainly a Java programmer...

I have an applications which reads some input from a named pipe to receive administrative commands. Everything works fine but the command which writes to the pipe blocks if my application is not running.

I would like to be able to test or have a return code or something other then blocking if there is nothing to read the pipe.

Currently, I am using a really simple shell script to send the command to the pipe, I'm only doing a printf "command\n" > pipename.

I've read in the man page that I hould receive a SIGPIPE if the reading process is non existing, but even when I try to "trap trapfunc SIGPIPE" the printf command still hangs and I have to kill the script by hand.

I would like to be able to handle this gracefully because if the application is not responding, it may be because it is actually crashed (a thread crashed ungracefully) but is still running so I would need to kill it instead.

Well, I hope I'm not too confusing with those explanation, thanks to all

Dan

Last edited by droussel; 05-22-2003 at 01:44 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ST7554: fifo underrun! Spriggan Linux - Hardware 2 03-01-2005 04:02 AM
snmptrapd FIFO eccsamba Linux - Networking 2 11-24-2004 08:52 AM
FIFO using pointers AquamaN Programming 2 03-21-2004 05:51 PM
FIFO question gauge73 Linux - Newbie 1 02-28-2003 11:39 PM
nfs FIFO??? granny Linux - Newbie 1 12-16-2002 03:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration