blob: acb7bfa1638f6a1c9d27ed23bd6603beb8ac1f02 [file] [log] [blame]
require 'open3'
class ShellCmdFilter < Nanoc3::Filter
identifier :shellcmd
#type :binary
def run(content, cmd, params={}) #params={ :cmd => "sed s/foo/bar/" })
Open3.popen3(cmd) do |stdin, stdout, stderr|
stdin.write(content)
stdin.close()
stdout.read()
end
end
end