Skip to content

fix(init): hard-fail when cwd cannot be determined - #343

Merged
diasbruno merged 1 commit into
clibs:masterfrom
diasbruno:review-and-add-tests-to-clib-init
Jul 18, 2026
Merged

fix(init): hard-fail when cwd cannot be determined#343
diasbruno merged 1 commit into
clibs:masterfrom
diasbruno:review-and-add-tests-to-clib-init

Conversation

@diasbruno

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 12, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 name and version are 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.

Comment thread src/clib-init.c Outdated
@diasbruno
diasbruno force-pushed the review-and-add-tests-to-clib-init branch 2 times, most recently from 92d79bc to 67899fe Compare July 13, 2026 21:53
jwerle
jwerle previously approved these changes Jul 14, 2026
@diasbruno diasbruno changed the title fix(init): hard-fail when cwd cannot be determined WIP: fix(init): hard-fail when cwd cannot be determined Jul 14, 2026
Comment thread src/clib-init.c Outdated
@diasbruno
diasbruno force-pushed the review-and-add-tests-to-clib-init branch from 67899fe to a4ec96f Compare July 15, 2026 00:39
@diasbruno diasbruno changed the title WIP: fix(init): hard-fail when cwd cannot be determined fix(init): hard-fail when cwd cannot be determined Jul 15, 2026
@diasbruno
diasbruno force-pushed the review-and-add-tests-to-clib-init branch from a4ec96f to df82c81 Compare July 18, 2026 01:32
@diasbruno
diasbruno merged commit ebc642f into clibs:master Jul 18, 2026
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants