Class: EventMachine::File

Inherits:
Object
  • Object
show all
Defined in:
lib/em-fs/file.rb,
lib/em-fs/file/stat.rb

Defined Under Namespace

Classes: Stat

Class Method Summary collapse

Class Method Details

.stat(path, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/em-fs/file.rb', line 8

def stat path, &block
  EM::SystemCommand.execute 'stat', [:format, EM::File::Stat::STAT_FORMAT], path do |on|
    on.success do |ps|
      block.call EM::File::Stat.parse ps.stdout.output
    end
    on.failure do |ps|
      raise "EM::File::stat failed. Output:\n#{ps.stderr.output}"
    end
  end
end