Skip to content

Instantly share code, notes, and snippets.

Created Jul 17, 2013
What would you like to do?
Bizarre Kernel.exec problem caused by "dropbox" gem
require 'bundler/setup'
Bundler.require :default
Kernel.exec ['/bin/ls', '/bin/ls'], '-al'

bundle install, then:

$ ruby the_problem.rb 
the_problem.rb:4:in `exec': No such file or directory - -al (Errno::ENOENT)
  from the_problem.rb:4:in `<main>'

Without dropbox:

$ ruby -e "Kernel.exec ['/bin/ls', '/bin/ls'], '-al'"
total 112
drwxr-xr-x  9 rsutphin  CB\Domain Users    306 Jul 17 14:57 .
drwxr-xr-x  5 rsutphin  CB\Domain Users    170 Jul 17 14:42 ..
-rw-r--r--  1 rsutphin  CB\Domain Users     45 Jul 17 15:09 Gemfile
-rw-r--r--  1 rsutphin  CB\Domain Users    246 Jul 17 14:58 Gemfile.lock
-rw-r--r--  1 rsutphin  CB\Domain Users     92 Jul 17 15:11 the_problem.rb

(i.e., the output from ls -al.)

The ultimate culprit is this code in dropbox/extensions/array.rb:

class Array # :nodoc:
  # [...]

  def to_hash # :nodoc:
    inject({}) { |hsh, (k,v)| hsh[k] = v  ; hsh }
  end unless method_defined?(:to_hash)
source ''
gem 'dropbox'
Copy link

rsutphin commented Jul 17, 2013

This is a practical problem because childprocess uses this form of exec call. childprocess is used by selenium-webdriver. So Selenium doesn't work to test a project that also includes this dropbox gem. You get errors like:

No such file or directory - --port=9516 (ChildProcess::LaunchError)

(with chromedriver), or

No such file or directory - -no-remote (ChildProcess::LaunchError)

(with firefox).

Copy link

brettporter commented Dec 12, 2013

The 'extlib' gem will cause the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment