static public Method

File.pipe?(p1)

File.pipe?(file_name)     true or false

Returns true if the named file is a pipe.

Source Code

/*
* call-seq:
*   File.pipe?(file_name)   =>  true or false
*
* Returns <code>true</code> if the named file is a pipe.
*/

static VALUE
test_p(obj, fname)
   VALUE obj, fname;
{
#ifdef S_IFIFO
#  ifndef S_ISFIFO
#    define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
#  endif

   struct stat st;

   if (rb_stat(fname, &st) < 0) return Qfalse;
   if (S_ISFIFO(st.st_mode)) return Qtrue;

#endif
   return Qfalse;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.