OS = Linux
hab = 0.9.3/20160916191534
hab pkg build .
Output
....
cp: omitting directory '/src/habitat/../source/app.tar.gz'
app: Build time: 0m14s
app: Exiting on error
Script done, file is /src/results/logs/..2016-09-27-135632.log
# echo $?
0
confirmed on my end too, thanks for reporting!
It appears as though we ignore the return value here: https://github.com/habitat-sh/habitat/blob/master/components/hab/src/exec.rs#L62
So easy I just out and out replaced the execv! see merge: https://github.com/habitat-sh/habitat/pull/1324
@metadave @dmajere - good to close?
Closed by #1324
Hey all, coming in late on this issue but the place to solve this one is in the Studio code base.
The hab command is calling execv(3) which _becomes_ replaces the current process image with a new one. In other words, the hab process becomes the hab-studio process (that's why there was no return on the exec_command() function--there is no return!).
I'm working up a PR which splits the difference with the fix in #1324 while still preserving the nature of posix/exec on systems that support it (namely all but Windows). I'll link to this issue.
I can see the issue above when running hab-studio directly via:
> /hab/pkgs/core/hab-studio/0.10.2/20160930230930/bin/hab-studio build .
hab-studio: Destroying Studio at /hab/studios/src (default)
hab-studio: Creating Studio at /hab/studios/src (default)
» Installing core/hab-backline
↓ Downloading core/hab-backline/0.10.2/20160930230909
...
★ Install of core/hab-backline/0.10.2/20160930230909 complete with 39 new packages installed.
» Symlinking hab from core/hab into /hab/studios/src/hab/bin
★ Binary hab from core/hab/0.10.2/20160930230245 symlinked to /hab/studios/src/hab/bin/hab
» Symlinking bash from core/bash into /hab/studios/src/bin
★ Binary bash from core/bash/4.3.42/20160729192720 symlinked to /hab/studios/src/bin/bash
» Symlinking sh from core/bash into /hab/studios/src/bin
★ Binary sh from core/bash/4.3.42/20160729192720 symlinked to /hab/studios/src/bin/sh
hab-studio: Building '.' in Studio at /hab/studios/src (default)
hab-studio: Exported: no_proxy=*.local, 169.254/16
Script started, file is /src/results/logs/..2016-10-05-160832.log
ERROR: Plan file not found at /src/plan.sh or /src/habitat/plan.sh
Script done, file is /src/results/logs/..2016-10-05-160832.log
> echo $?
0
Just so we can track this through to completion, I'm going to re-open this one.
Thanks all!
Cool @fnichol - I didn't know enough about the inner workings to know that Studio was the better place to fix this issue. That being said, I do think it make sense to leverage std::process::Command vs. execv wherever possible, you can "shell out" inline.
Mind tagging me in your PR so I can get a sense of what your solution is?
@rrxtns Absolutely will do. In support of what I'm currently working on, I want the specific behavior of exec vs fork/exec (or spawn) so hopefully this will make more sense shortly.
@rrxtns As promised, you can check out #1329 with most of the relevant parts in the first commit (link good unless and until we rebase). Hope this helps!
Got this, and y'all are going to love it 😉
Given the solution was so small (add -e to the script call in our record() function), this could have taken forever to find! Thanks all for your help on this one!