Module: Nanoc::Webpack::Spawn
- Included in:
- Filter
- Defined in:
- lib/nanoc/webpack/spawn.rb
Constant Summary collapse
- Error =
Class.new(RuntimeError)
Instance Method Summary collapse
-
#spawn(exe, argv) ⇒ Integer
Spawns a process.
Instance Method Details
#spawn(exe, argv) ⇒ Integer
Spawns a process
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nanoc/webpack/spawn.rb', line 19 def spawn(exe, argv) r = cmd(exe, *argv) if r.not_found? raise Nanoc::Tidy::Error, "The #{exe} executable was not found" elsif r.success? r.exit_status else raise Error, "#{File.basename(exe)} exited unsuccessfully\n" \ "(item: #{item.identifier})\n" \ "(exit code: #{r.exit_status})\n" \ "(stdout: #{r.stdout.gsub(Dir.getwd, "")[1..]&.chomp})\n" \ "(stderr: #{r.stderr.gsub(Dir.getwd, "")[1..]&.chomp})\n", [] end end |