Skip to content

feat(cli-hooks): exit the start process with the subprocess exit code#2153

Merged
zimeg merged 2 commits intomainfrom
zimeg-feat-cli-hooks-start-process-exit-code
Feb 27, 2025
Merged

feat(cli-hooks): exit the start process with the subprocess exit code#2153
zimeg merged 2 commits intomainfrom
zimeg-feat-cli-hooks-start-process-exit-code

Conversation

@zimeg
Copy link
Copy Markdown
Member

@zimeg zimeg commented Feb 22, 2025

Summary

This PR uses process.exit to exit the "start" hook with the exit code matching the provided script 👾

Preview

exit.mov

Reviewers

Testing this requires a development CLI build that avoids overwriting these exit codes as well!

Recommended start hook cases to test might include:

  • No change! The app should run or error as expected
  • exit 2! Use a custom error code
  • sleep 12! Interrupt a waiting process

Notes

IIRC the console.log that was removed was used as a shortcut for exiting as expected! This is removed which might cause confusion in CLI versions v2.33.0 or earlier since the process hangs intead of exits... Fixes are following in the development build!

Requirements

@zimeg zimeg added semver:minor enhancement M-T: A feature request for new functionality pkg:cli-hooks applies to `@slack/cli-hooks` labels Feb 22, 2025
@zimeg zimeg added this to the cli-hooks@1.2.0 milestone Feb 22, 2025
@zimeg zimeg requested a review from mwbrooks February 22, 2025 22:28
@zimeg zimeg self-assigned this Feb 22, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.94%. Comparing base (9048fd9) to head (331be69).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2153   +/-   ##
=======================================
  Coverage   91.94%   91.94%           
=======================================
  Files          38       38           
  Lines       10328    10328           
  Branches      652      652           
=======================================
  Hits         9496     9496           
  Misses        820      820           
  Partials       12       12           
Flag Coverage Δ
cli-hooks 95.23% <100.00%> (ø)
cli-test 94.76% <ø> (ø)
oauth 77.39% <ø> (ø)
socket-mode 61.82% <ø> (ø)
web-api 96.88% <ø> (ø)
webhook 96.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Copy Markdown
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 👌🏻 Well done @zimeg!

@zimeg
Copy link
Copy Markdown
Member Author

zimeg commented Feb 27, 2025

@mwbrooks Thanks a ton! I'm hoping to merge this soon and am investigating another hook change around running certain scripts within project directories.

That might require changes to other hook implementations so I'm unsure if it makes sense to wait on that change before the next release - I'll follow up in a bit! 🤔

@zimeg
Copy link
Copy Markdown
Member Author

zimeg commented Feb 27, 2025

Ahh... It appears that more changes in different places are needed to read the manifest from a nested directory 🫡

For now I'll merge this and will begin follow ups for a following release.

@zimeg zimeg merged commit e56f0ed into main Feb 27, 2025
57 checks passed
@zimeg zimeg deleted the zimeg-feat-cli-hooks-start-process-exit-code branch February 27, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality pkg:cli-hooks applies to `@slack/cli-hooks` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants