Run build step failed with subshell on CircleCI which it is hard coded to exit 0




I have a build step like this

   - run:
       name: Hello
       command: |

On CircleCI, it is just simply saying: Exited with code 1

I have few similar builds before it which running under subshell too and they still work fine. I tried to SSH into the CircleCI and execute above subshell, I got the exit code is 0

Inside command_2, I added return 0. There is no error with any command inside that script.

Any advice would be appreciated so much :frowning:



Don’t you need to separate those commands with && or ;?


command_1 will change directory, command_2 is a shell script. In previous subshells, I use exactly same thing, cd and shell script, but the exit-code is 0 for them


What is the actual, full, real command?


something like

  cd path/to/directory

I use exactly same as above after SSH and $? is 0.


OK. What’s the purpose of the subshell here? Can you remove the brackets?


I don’t want to change the current working directory, then have to use cd -. But is there any reason if previous ones still working?


Gotcha. Well, I’d suggest you get it working first :smile_cat:. You can also preserve the dir using:


Or, alternatively, can you modify the script so that it takes a dir/file parameter? That is generally better than needing to be in a specific cwd anyway.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.