Skip to content

fix(create): mark dart_cli entrypoint as executable after generation - #1786

Closed
uveshm003 wants to merge 1 commit into
VeryGoodOpenSource:mainfrom
uveshm003:fix/dart-cli-entrypoint-executable
Closed

uveshm003 wants to merge 1 commit into
VeryGoodOpenSource:mainfrom
uveshm003:fix/dart-cli-entrypoint-executable

Conversation

@uveshm003

Copy link
Copy Markdown

Status

READY

Description

Closes #1783

Mason doesn't keep file permissions, so the bin/<executable_name>.dart entrypoint of a very_good create dart_cli project wasn't executable. very_good_templates#664 does the chmod in the brick's post_gen hook, but Very Good CLI never runs post_gen hooks.

This PR:

  • adds makeEntrypointsExecutable to post_generate_actions.dart. It runs chmod +x on the .dart files in the generated bin directory. It does nothing on Windows, or when there is no bin directory or no Dart files in it.
  • adds a small Chmod wrapper in lib/src/cli/ so the call goes through _Cmd and ProcessOverrides, like Git and Dart
  • calls it from VeryGoodDartCLITemplate.onGenerateComplete, after pub get/dart fix

I matched bin/*.dart instead of passing executable_name through, because onGenerateComplete doesn't receive the template vars.

Tests:

  • test/src/cli/chmod_cli_test.dart checks the chmod +x <paths> invocation
  • dart_cli_test.dart creates a project whose bin holds my_executable.dart and README.md, then checks that only the Dart file gets the owner-execute bit. A second test checks that a bin with no Dart files is left alone. Both are skipped on Windows. The first test fails without the change.

dart analyze --fatal-infos --fatal-warnings . and dart format lib test are clean.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@uveshm003
uveshm003 requested a review from a team as a code owner October 28, 2026 11:28
@marcossevilla

Copy link
Copy Markdown
Member

hi @uveshm003, thanks for opening a PR!

we will hold on this one since the feature it's still not supported as part of the Dart CLI template, we will track this change when it's published already, so if it's good with you, we'll close this PR since we can't test this with the current template bundle in the CLI.

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.

fix: mark dart_cli entrypoint as executable after generation

2 participants