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