Last active
June 5, 2021 18:39
-
-
Save jamesarosen/e29076bd81a099f0f72e to your computer and use it in GitHub Desktop.
Revisions
-
jamesarosen revised this gist
Jun 18, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,8 @@ script: - (eval "$TEST_COMMAND") ``` The `eval` inherits the current shell's environment, and the `(...)` wrapping creates a sub-shell to isolate this shell from the effects of `TEST_COMMAND`. ### Things That Didn't Work This was my first attempt. I still don't quite understand why it doesn't work. -
jamesarosen created this gist
Jun 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ I have a project that's been happily chugging along on [Travis](http://travis-ci.com) for a while. Its `.travis.yml` looks something like ```yml script: - node_modules/ember-cli/bin/ember test ``` I wanted to add a second parallel build that did something *very* different. I didn't want to run `ember test` with a different Ember version or some other flag. I wanted to run a completely different command. Specifically, I wanted to run [LicenseFinder](https://github.com/pivotal/LicenseFinder)'s audit. Travis has [great docs](http://docs.travis-ci.com/user/customizing-the-build/) on customizing parallel builds, but nothing describes how to do two completely different commands. I poked at Bash for a while and finally came up with ```yml env: - TEST_COMMAND="node_modules/ember-cli/bin/ember test" - TEST_COMMAND="bundle exec license_finder" script: - (eval "$TEST_COMMAND") ``` ### Things That Didn't Work This was my first attempt. I still don't quite understand why it doesn't work. ```yml script: - $TEST_COMMAND ``` A second go breaks because I didn't wrap the argument to `bash -c` in quotes, meaning any arguments I tried to pass to `ember` got lost: ```yml script: - bash -c $TEST_COMMAND ``` But even wrapping it in quotes failed because `bash -c` loses too much of the environment: ```yml script: - bash -c "$TEST_COMMAND" ```