Use POSIX::Spawn instead of system to launch Jekyll
This commit is contained in:
parent
f9bc50e010
commit
106148280d
|
@ -1,11 +1,12 @@
|
|||
require 'fileutils'
|
||||
require 'posix-spawn'
|
||||
require 'rr'
|
||||
require 'test/unit'
|
||||
require 'time'
|
||||
|
||||
JEKYLL_SOURCE_DIR = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||
TEST_DIR = File.expand_path(File.join('..', '..', 'tmp', 'jekyll'), File.dirname(__FILE__))
|
||||
JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll')
|
||||
JEKYLL_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll'))
|
||||
JEKYLL_COMMAND_OUTPUT_FILE = File.join(File.dirname(TEST_DIR), 'jekyll_output.txt')
|
||||
|
||||
def source_dir(*files)
|
||||
|
@ -17,11 +18,12 @@ def jekyll_output_file
|
|||
end
|
||||
|
||||
def jekyll_run_output
|
||||
File.read(jekyll_output_file)
|
||||
File.read(jekyll_output_file) if File.file?(jekyll_output_file)
|
||||
end
|
||||
|
||||
def run_jekyll(args)
|
||||
system "#{JEKYLL_PATH} #{args} --trace > #{jekyll_output_file} 2>&1"
|
||||
child = POSIX::Spawn::Child.new JEKYLL_PATH, *args.strip.split(' '), "--trace", :out => [JEKYLL_COMMAND_OUTPUT_FILE, "w"]
|
||||
child.status.exitstatus == 0
|
||||
end
|
||||
|
||||
def slug(title)
|
||||
|
|
Loading…
Reference in New Issue