Sublime Forum

Strange build results - OS X El Capitan

#1
  • Sublime Buid 3103 (OS X El Capitan)

  • Issue:
    Trying to run code (tested with Ruby, Tcl and Scala) results in the correct console output but always has an additional line:
    /bin/bash: shell_session_update: command not found
    -not sure what is causing this, any ideas?

  • Additional Info:
    Tested with opening sublime from terminal too, -same result. Running scripts directly from the terminal does not present this issue.


  • Code example in Ruby

def x
‘Hello’
end
puts x

  • Results in:

Hello
/bin/bash: shell_session_update: command not found
[Finished in 0.2s]

0 Likes

#2

As discussed in a few other threads, the environment for processes launched directly from GUI applications like Sublime Text is different to the environment in a login shell. Usually this mainly affects the PATH environment variable. In this particular case it looks like the shell launched by Sublime Text is not picking up the bash functions defined in /etc/bashrc_Apple_Terminal. Though, I must admit, I have not been able to find what is attempting to call the shell_session_update() shell function apart from the trap instruction in /etc/bashrc_Apple_Terminal itself. In other words, the only thing I can find invoking the apparently missing function is the script that defines that function, which means the function shouldn’t be missing.

Also, stepping back one moment, why is a Ruby script somehow invoking a bash shell? Are you putting the correct hashbang at the start of your script, to invoke Ruby directly instead of a shell that invokes Ruby?

0 Likes

#3

No hashbang at the start of the script, I’ve never had to do this previously, the output in Sublime on Yosemite for the same script does not have this issue. I have tried running Scala and Tcl scripts and all do the exact same thing, -script output followed by /bin/bash: shell_session_update: command not found.

0 Likes

#4

OK, forget about the hashbang. It’s not clear to me how you are invoking your scripts from Sublime Text, but from the output you describe it’s most likely that Sublime Text is invoking your default shell (i.e. bash) and then running your script. I don’t run scripts from with ST myself, but I would guess if you had the correct hashbang the system would figure out the correct interpreter to run, and wouldn’t use the default shell as an intermediary. But that’s just a guess because I haven’t tried it myself.

As for:

the output in Sublime on Yosemite for the same script does not have this issue

It looks like the shell_session_update() stuff was only added in El Capitan, which is why whatever bash is doing now it wasn’t doing in Yosemite. Hence, no message there.

I still think you should do whatever you need to do to run your scripts directly, not via a shell.

0 Likes