Skip to content

Commit

Permalink
Fix clippy, pwsh analyzer, and windows build
Browse files Browse the repository at this point in the history
Signed-off-by: David McNeil <mcneil.david2@gmail.com>
  • Loading branch information
davidMcneil committed Jul 7, 2020
1 parent 01b9645 commit 65495b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions components/common/src/templating/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ pub trait HookExt: Hook<ExitValue = ExitStatus> + Sync {
/// `templating::compile_for_package_install`)
/// * run the hook
/// * return an error if we get a non-zero exit code
async fn find_run_and_error_for_status<U>(ui: &mut U, package: &PackageInstall) -> Result<()>
where U: UIWriter
{
async fn find_run_and_error_for_status<U: UIWriter>(ui: &mut U,
package: &PackageInstall)
-> Result<()> {
let feature_flags = FeatureFlag::from_env(ui);
let package_name = &package.ident.name;
if let Some(ref hook) = Self::load(package_name,
Expand All @@ -350,7 +350,7 @@ pub trait HookExt: Hook<ExitValue = ExitStatus> + Sync {
let mut pkg = Pkg::from_install(package).await?;
// Hooks do not have access to svc_passwords so we execute them under the current
// user account.
if let Some(user) = users::get_current_username() {
if let Some(user) = habitat_core::os::users::get_current_username() {
pkg.svc_user = user;
}
pkg
Expand Down
18 changes: 8 additions & 10 deletions test/end-to-end/test_alternate_error_exit_codes.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
Describe "install and uninstall hook error codes are propogated" {
BeforeAll {
$PkgName = "custom-hook-exit-code"
$PkgOrigin = "habitat-testing"
$PkgIdent = "$PkgOrigin/$PkgName"
$Env:HAB_ORIGIN = $PkgOrigin
hab origin key generate $PkgOrigin
Invoke-Build $PkgName
. ./results/last_build.ps1
}
$PkgName = "custom-hook-exit-code"
$PkgOrigin = "habitat-testing"
$PkgIdent = "$PkgOrigin/$PkgName"
$Env:HAB_ORIGIN = $PkgOrigin
hab origin key generate $PkgOrigin
Invoke-Build $PkgName
. ./results/last_build.ps1

Describe "install and uninstall hook error codes are propogated" {
It "`hab pkg install` exits with install hook exit code" {
$Env:CUSTOM_HOOK_EXIT_CODE = 42
hab pkg install ./results/$pkg_artifact
Expand Down

0 comments on commit 65495b5

Please sign in to comment.