aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorfhemberger <mail@frederic-hemberger.de>2011-09-12 21:36:14 +0200
committerfhemberger <mail@frederic-hemberger.de>2011-09-12 21:36:14 +0200
commit565648300b3c79330d4f3b75161ebefce9414e04 (patch)
treec793ce8150879416bf929139692c392dcc6ea25b /Rakefile
parent04973e0948670a643368ee973cb24a7fdb0b2b62 (diff)
downloadmy_new_personal_website-565648300b3c79330d4f3b75161ebefce9414e04.tar.xz
my_new_personal_website-565648300b3c79330d4f3b75161ebefce9414e04.zip
Fix an issue in 'watch' and 'preview' where main process is terminated with child processes still running
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile15
1 files changed, 6 insertions, 9 deletions
diff --git a/Rakefile b/Rakefile
index f67596f4..881929a6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -60,12 +60,11 @@ task :watch do
compassPid = Process.spawn("compass watch")
trap("INT") {
- Process.kill(9, jekyllPid)
- Process.kill(9, compassPid)
- exit 0
+ [jekyllPid, compassPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
+ exit 0
}
- Process.wait
+ [jekyllPid, compassPid].each { |pid| Process.wait(pid) }
end
desc "preview the site in a web browser"
@@ -77,13 +76,11 @@ task :preview do
rackupPid = Process.spawn("rackup --port #{server_port}")
trap("INT") {
- Process.kill(9, jekyllPid)
- Process.kill(9, compassPid)
- Process.kill(9, rackupPid)
- exit 0
+ [jekyllPid, compassPid, rackupPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
+ exit 0
}
- Process.wait
+ [jekyllPid, compassPid, rackupPid].each { |pid| Process.wait(pid) }
end
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")