• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
writing to a named pipe (FIFO) fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

writing to a named pipe (FIFO) fails


  • Subject: writing to a named pipe (FIFO) fails
  • From: Cameron Hayne <email@hidden>
  • Date: Tue, 21 Nov 2006 08:32:04 -0500

I am trying (but failing) to write to a FIFO or named pipe (http:// en.wikipedia.org/wiki/Named_pipe) from AppleScript.
Here's an example script (the named pipe at "/Users/myusername/ mystuff/myfifo" is set up previously in a Terminal window):
------------------------------------------------------------------------ ----
set fifo to "/Users/myusername/mystuff/myfifo"
do shell script "echo AAA > " & fifo


set macFifo to POSIX file fifo

try
	write "BBB" to macFifo
on error errString number errNum
	display alert errString & " (" & errNum & ")"
end try

try
set fd to open for access macFifo with write permission
write "CCC" to fd
close access fd
on error errString number errNum
display alert errString & " (" & errNum & ")"
end try
------------------------------------------------------------------------ ----
The 'do shell script' works fine and the "AAA" gets transmitted to the named pipe.
But the two attempts ("BBB" & "CCC") to write to the named pipe using 'write' both fail with error -36 which is "ioErr (-36): I/O error (bummers)".
Note that if I change the above example to refer to a regular file, it all works fine.


Is there any way to write to a named pipe (FIFO) using 'write' in AppleScript?
I want to avoid the use of 'do shell script' for reasons of performance (each 'do shell script' seems to take about 0.1 second and in my AppleScript I will be doing thousands of writes to the named pipe).


--
Cameron Hayne
email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: writing to a named pipe (FIFO) fails
      • From: Malcolm Fitzgerald <email@hidden>
    • Re: writing to a named pipe (FIFO) fails
      • From: Adam Bell <email@hidden>
  • Prev by Date: need help in Apple script
  • Next by Date: Re: writing to a named pipe (FIFO) fails
  • Previous by thread: need help in Apple script
  • Next by thread: Re: writing to a named pipe (FIFO) fails
  • Index(es):
    • Date
    • Thread