Class: IO

Inherits:
Object
  • Object
show all
Defined in:
lib/misc/util.rb

Instance Method Summary collapse

Instance Method Details

#close_on_execObject



58
59
60
# File 'lib/misc/util.rb', line 58

def close_on_exec
  self.fcntl(Fcntl::F_GETFD) & Fcntl::FD_CLOEXEC != 0
end

#close_on_exec=(v) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/misc/util.rb', line 62

def close_on_exec=(v)
  flags = self.fcntl(Fcntl::F_GETFD)
  if v
    flags |= Fcntl::FD_CLOEXEC
  else
    flags &= ~Fcntl::FD_CLOEXEC
  end
  self.fcntl(Fcntl::F_SETFD, flags)
  v
end