Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
File.pipe?
(::path | ::IO file_name) -> bool
File.pipe?(path) → true or false
file.c
View on GitHub ↗
static VALUE
rb_file_pipe_p(VALUE obj, VALUE 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;
}
Returns whether the entry at the given path is a pipe:
Example
File.pipe?('doc/syntax/') # => false # Directory. File.pipe?('doc/maintainers.md') # => false # Regular file. File.pipe?('nosuch') # => false # Non-existent. path = '/tmp/foo' File.mkfifo(path) File.pipe?(path) # => true File.delete(path) # Clean up.