Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"Error getting the output..." message when run #2

Open
brentd opened this Issue · 12 comments

4 participants

@brentd

Nice idea! Getting an error when selecting the List Gems from the command palette.

Based on the code my first guess would be that bundle isn't in the $PATH that Sublime is using.

I'm on OS 10.8.2 using zsh and rbenv.

$ which bundle
/usr/local/opt/rbenv/shims/bundle

$ echo $PATH
/usr/local/bin:/usr/local/share/npm/bin/:/usr/local/opt/rbenv/shims:/usr/local/opt/rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

Sublime doesn't seem to pick up my path. In the Sublime console:

>>> import os
>>> os.environ['PATH']
'/usr/bin:/bin:/usr/sbin:/sbin'
@brentd

Apparently you have to add your PATH to ~/.MacOSX/environment.plist and logout before it will take effect. I haven't tried this yet as logging out is a huge pain :)

Reference: http://www.sublimetext.com/forum/viewtopic.php?f=3&p=7872

@brentd

@NaN1488 FWIW it looks like the Git package solved this with a setting: https://github.com/kemayo/sublime-text-2-git/blob/master/Git.sublime-settings#L7

@nnc

@brentd how did you install rbenv (manually, homebrew, macports)? What does the which rbenv say?

I get the same error like you, and I tracked it down to the rbenv_command in run_subprocess(). Problem is rbenv can be installed anywhere, but ~/.rbenv/bin is always assumed.

Homebrew installs rbenv in /usr/local/bin, which is not in the $PATH so in my case rbenv goes undetected. I'm pretty sure its the same thing in your case.

As you suggest, setting may be needed here as rbenv can be installed anywhere. Although, automatically checking a few common paths would probably make this work for 99% of rbenv users.

Paths to check on OS X:

  • ~/.rbenv/bin - manual install by following instructions in the rbenv README
  • /usr/local/bin - default Homebrew install
  • default path for MacPorts install
@bbonamin
Collaborator

Hey @brentd, @nnc thanks for your input and submitting this bug report.

When developing this plugin I was using RVM on the Mac so I didn't encounter this issue (rbenv support was checked in from linux).

We probably should change the way that rbenv/rvm are invoked for something more generic.

I like @nnc suggestions about the default paths to check on OS X, but I wonder if there is an easier way to invoke rbenv/rvm from the command line without knowing the exact path.

Thoughts, @NaN1488 ?

@NaN1488
Owner

Hi guys, I didn't research about this issue yet.

I guess we could find a better way to get the exact path for rbenv/rvm, but could be hard to cover all cases.

I was thinking to attack this problem letting the user add settings, with this approach the plugin will be more flexible for users with installations that are not by default.

Thanks @brentd and thanks @nnc, we will try to fix it ASAP.

@nnc

Actually, for rbenv I think it should be enough to just invoke ~/.rbenv/shims/bundle directly, instead of trying to init rbenv first. It seems both Homebrew and manually installed rbenv install shims in ~/.rbenv/shims and we can just invoke the bundle shim directly, without worrying where rbenv is actually installed.

So the check for rbenv would be does ~/.rbenv/shims/bundle exist, and if so then just cd into project dir and invoke ~/.rbenv/shims/bundle list.

Of course, there's a chance that rbenv is installed, but not actually used/loaded, in which case this would be a wrong thing to do. But this will make Gem List work out of the box for great majority of rbenv users I hope.

And explicit setting, once added, can always be used to override this default.

I just think it would be wrong to require everyone to explicitly set their rbenv or rvm paths when most people use a couple default setups.

@bbonamin
Collaborator

Yes I agree that having everyone set an explicit setting would be cumbersome when we can assume some defaults for most of the users. We'll look into your suggestion @nnc

@bbonamin bbonamin referenced this issue from a commit
@bbonamin bbonamin Improved support for rbenv
When searching for rbenv, now the plugin tries to load the bundler shim
instead of initializing rbenv directly.
0ea977c
@bbonamin
Collaborator

Hey @brentd, @nnc I just added a commit that fixed the rbenv issue in my homebrew installed rbenv (default installation inside my ~ folder). Could you check if the plugin is working for you guys?

After a more detailed reading seems like you @brentd have rbenv shims inside the opt directory, we'll be adding a config file in the next few days to support locations other than default.

@bbonamin
Collaborator

The plugin as installed from Package Control now should work with rbenv executing from ~/.rbenv/shims Coming up is the ability to configure the path from a config file.

@brentd

Sorry for lack of response on this. @bbonamin tried reinstalling the package and no change for me, still throwing the same error :( not sure what my deal is - I haven't done anything non-standard to my rbenv installation AFAIK.

@bbonamin
Collaborator

hey @brentd no issues :), mmm do you get any output if you i.e. run ~/.rbenv/shims/bundle list in your project directory? This is what we're invoking now from within this plugin, in addition to ~/.rbenv/shims/bundle show GEM_NAME

@brentd

Nope, I don't have the bundle binary at that location. Mine are in /usr/local/opt/rbenv/shims.

$ which bundle
/usr/local/opt/rbenv/shims/bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.