fix(init): hard-fail when cwd cannot be determined - #343
Merged
diasbruno merged 1 commit intoJul 18, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates clib-init to be stricter about determining the current working directory name and to normalize interactive input, adding a shell test to validate whitespace-trimmed values written to package.json.
Changes:
- Treat
getcwd()failure as a hard error and exit early. - Switch stdin reading to
fgets()and trim leading/trailing whitespace from user input. - Add a regression test ensuring trimmed
nameandversionare written to the generated manifest.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/clib-init.c |
Adds hard-fail when CWD cannot be determined; trims interactive input before writing JSON fields. |
test/init.sh |
New test that pipes padded input and asserts the written JSON contains trimmed name/version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
diasbruno
force-pushed
the
review-and-add-tests-to-clib-init
branch
2 times, most recently
from
July 13, 2026 21:53
92d79bc to
67899fe
Compare
jwerle
previously approved these changes
Jul 14, 2026
diasbruno
commented
Jul 14, 2026
diasbruno
force-pushed
the
review-and-add-tests-to-clib-init
branch
from
July 15, 2026 00:39
67899fe to
a4ec96f
Compare
jwerle
approved these changes
Jul 17, 2026
diasbruno
force-pushed
the
review-and-add-tests-to-clib-init
branch
from
July 18, 2026 01:32
a4ec96f to
df82c81
Compare
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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.