aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-04-30 11:42:44 +0100
committerMark Longair <mhl@pobox.com>2013-05-16 09:06:27 +0100
commitbe5077d5f1af176c34aadd3dcfc6fd3ac9422a3d (patch)
tree3bb36123545a28f2055d35f309e6771ed12c3624
parentad0af8f9deb3da28c3630e369b74932d465b349f (diff)
Remove an unnecessary use of 'which' in backticks
The use of backticks in `which tnef` means that which(1) is invoked under /bin/sh, and returns the first executable matching 'tnef' in the default PATH for /bin/sh. In this usage, however, Popen also uses /bin/sh to execute the command, which would run that same executable if just a bare 'tnef' were used. In summary, I can't see any reason for the convolution of: IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "wb") do |f| ... over just: IO.popen("tnef -K -C #{dir}", "wb") do |f| ... so switch to the latter.
-rw-r--r--lib/mail_handler/mail_handler.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb
index d9ebee854..e5c6b1087 100644
--- a/lib/mail_handler/mail_handler.rb
+++ b/lib/mail_handler/mail_handler.rb
@@ -14,7 +14,7 @@ module MailHandler
def tnef_attachments(content)
attachments = []
Dir.mktmpdir do |dir|
- IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "wb") do |f|
+ IO.popen("tnef -K -C #{dir}", "wb") do |f|
f.write(content)
f.close
if $?.signaled?