Author Topic: pre and post build commands versus shell  (Read 5065 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
pre and post build commands versus shell
« on: March 09, 2016, 05:00:40 pm »
I came across something by doing the following :
- i had to have a pre build job, which would generate some header files which would be included by the source of the current cbp project
- these were generated by calling a ruby  script
- however the ruby to be used could not be the 'modern' system installed version, but an 'old' one which was installed via rbenv, which basically boils down to, the entire system used the modern one, except the top directory of the development workspace (and beneath) uses the old one

So when running in a shell at the location where the cbp file resides :

rbenv versions
  system
  1.8.7-p370
* 1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)

rbenv version
1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)

ruby --version
ruby 1.8.7 (2013-12-23 patchlevel 375) [x86_64-linux]


However when those commands would be fed as the "pre build tasks" : rbenv versions && rbenv version && ruby --version

[100.0%] Running project pre-build steps
rbenv versions && rbenv version && ruby --version
  system
  1.8.7-p370
* 1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)
1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux-gnu]


==> it is again using the system ruby !!!


I was able to solve this, as follows , specify as pre build command :  /bin/bash -lc  "rbenv versions && rbenv version && ruby --version"
and then we get :
[100.0%] Running project pre-build steps
/bin/bash -lc  "rbenv versions && rbenv version && ruby --version"
  system
  1.8.7-p370
* 1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)
1.8.7-p375 (set by /home/killerbot/Projects/XXX/.ruby-version)
ruby 1.8.7 (2013-12-23 patchlevel 375) [x86_64-linux]

So why is the shell started by CB not inheriting all the things it could ? should ?

Should we have a check mark in order to get that inheritance (eg that CB then knows to run everything through "/bin/bash -lc "......" ?

What do  you think ?



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: pre and post build commands versus shell
« Reply #1 on: March 09, 2016, 09:17:54 pm »
What do  you think ?
Probably check Settings -> Environment -> General settings -> Shell to run commands in.  ;)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]