How to create a pipe file ("mkfifo pipe_file")

Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

Thanks.

···

--
Iñaki Baz Castillo <ibc@aliax.net>

By the way, is it better to use a pipe_file or a UNIX socket? both are IO
objects but, is there any advantage in using some of them?

Thanks.

···

El Jueves, 7 de Enero de 2010, Iñaki Baz Castillo escribió:

Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

--
Iñaki Baz Castillo <ibc@aliax.net>

I see you've been asking a lot of questions over the Xmas break which seem to amount to "how the heck do I tame Unix from Ruby". Whilst they're by no means the full answer, take a look at the "Ruby Plumber's Guide" presentations linked from my sig and google the couple of videos that accompany them (there's one from GoRuCo, another from Rails Underground, and possibly others too).

There should be enough between them to give you an idea of how to use Unix system calls from standard Ruby with syscall and Ruby/DL (or with a bit of thought from Ruby/FFI).

Also grab yourself a copy of Marc Rochkind's "Advanced Unix Programming" and then spend a few days with the man pages for your favourite Unix distro. Whilst the POSIX calls have the advantage of being fairly portable you'll find most platforms have some cool calls of their own.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

···

On 7 Jan 2010, at 16:05, Iñaki Baz Castillo wrote:

Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

----
raise ArgumentError unless @reality.responds_to? :reason

It depends on your usage model: if you need to know every individual client then you need to use a socket. If you just can read message after message from wherever it came you can use a named pipe. Also, IIRC a named pipe signals EOF once a writer has closed its end. So both have a quite different usage model...

Kind regards

  robert

···

On 01/07/2010 06:19 PM, Iñaki Baz Castillo wrote:

El Jueves, 7 de Enero de 2010, Iñaki Baz Castillo escribió:

Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

By the way, is it better to use a pipe_file or a UNIX socket? both are IO objects but, is there any advantage in using some of them?

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Thanks a lot, I'm already reading such documentation :slight_smile:

···

El Viernes, 8 de Enero de 2010, Eleanor McHugh escribió:

On 7 Jan 2010, at 16:05, Iñaki Baz Castillo wrote:
> Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
> Which is the command to behave as system "mkfifo pipe_file"?

I see you've been asking a lot of questions over the Xmas break which seem
to amount to "how the heck do I tame Unix from Ruby". Whilst they're by no
means the full answer, take a look at the "Ruby Plumber's Guide"
presentations linked from my sig and google the couple of videos that
accompany them (there's one from GoRuCo, another from Rails Underground,
and possibly others too).

There should be enough between them to give you an idea of how to use Unix
system calls from standard Ruby with syscall and Ruby/DL (or with a bit of
thought from Ruby/FFI).

Also grab yourself a copy of Marc Rochkind's "Advanced Unix Programming"
and then spend a few days with the man pages for your favourite Unix
distro. Whilst the POSIX calls have the advantage of being fairly portable
you'll find most platforms have some cool calls of their own.

--
Iñaki Baz Castillo <ibc@aliax.net>

Yes, this is my case :slight_smile:

···

El Jueves, 7 de Enero de 2010, Robert Klemme escribió:

On 01/07/2010 06:19 PM, Iñaki Baz Castillo wrote:
> El Jueves, 7 de Enero de 2010, Iñaki Baz Castillo escribió:
>> Hi, I don't find the appropriate command to create a "pipe" file in
>> Ruby. Which is the command to behave as system "mkfifo pipe_file"?
>
> By the way, is it better to use a pipe_file or a UNIX socket? both are IO
> objects but, is there any advantage in using some of them?

It depends on your usage model: if you need to know every individual
client then you need to use a socket.

If you just can read message after message from wherever it came you can use
a named pipe.

--
Iñaki Baz Castillo <ibc@aliax.net>

I should add that there's also a wealth of useful code lurking on Github - especially amongst Ara T. Howard's stuff.

Oh, and despite what the docs might say it seems to be perfectly safe (at least under mainstream Unix implementations) to load libc with either Ruby/DL or Ruby-FFI :slight_smile:

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

···

On 8 Jan 2010, at 13:22, Iñaki Baz Castillo wrote:

El Viernes, 8 de Enero de 2010, Eleanor McHugh escribió:

I see you've been asking a lot of questions over the Xmas break which seem
to amount to "how the heck do I tame Unix from Ruby". Whilst they're by no
means the full answer, take a look at the "Ruby Plumber's Guide"
presentations linked from my sig and google the couple of videos that
accompany them (there's one from GoRuCo, another from Rails Underground,
and possibly others too).

There should be enough between them to give you an idea of how to use Unix
system calls from standard Ruby with syscall and Ruby/DL (or with a bit of
thought from Ruby/FFI).

Also grab yourself a copy of Marc Rochkind's "Advanced Unix Programming"
and then spend a few days with the man pages for your favourite Unix
distro. Whilst the POSIX calls have the advantage of being fairly portable
you'll find most platforms have some cool calls of their own.

Thanks a lot, I'm already reading such documentation :slight_smile:

----
raise ArgumentError unless @reality.responds_to? :reason