From 1611adcff9797a19f0ec7bf4ff3659e51fbd630e Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sat, 25 Mar 2017 15:35:33 -0700 Subject: [PATCH] [meta] make alfredworkflow.clean work w/OS X ruby --- bin/alfredworkflow.clean | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/alfredworkflow.clean b/bin/alfredworkflow.clean index 8babd7a..e1b8368 100755 --- a/bin/alfredworkflow.clean +++ b/bin/alfredworkflow.clean @@ -2,8 +2,15 @@ require 'tempfile' +def with_tempfile(name) + file = Tempfile.new(name) + yield file +ensure + file.close +end + plist = ARGF.read -Tempfile.create('info.plist') do |f| +with_tempfile('info.plist') do |f| f << plist f.flush