Closed scottbisaillon closed 3 years ago
Also windows 10, but version 0.4.11+2.
I just recently tried using melos and am experiencing the same problem with it running multiple times (although it always finishes, just takes a really long time since it runs over and over).
I followed the instructions to setup (pub global activate) and, bootstrapped, and then used the following:
melos exec -- flutter pub get
I tried many different options (fail-fast, -c, etc) to try but all had the same problem.
It even runs twice just for the help command, showing the following when I run melos -h
:
A CLI tool for managing Dart & Flutter projects with multiple packages.
Usage: melos <command> [arguments]
Global options:
-h, --help Print this usage information.
--verbose Enable verbose logging.
--no-private Exclude private packages (`publish_to: none`). They are included by default.
--[no-]published Filter packages where the current local package version exists on pub.dev. Or "-no-published" to filter packages that have not had their current version
published yet.
--[no-]nullsafety Filter packages where the current local version uses a "nullsafety" prerelease preid. Or "-no-nullsafety" to filter packages where their current version
does not have a "nullsafety" preid.
--[no-]flutter Filter packages where the package depends on the Flutter SDK. Or "-no-flutter" to filter packages that do not depend on the Flutter SDK.
--scope=<glob> Include only packages with names matching the given glob. This option can be repeated.
--ignore=<glob> Exclude packages with names matching the given glob. This option can be repeated.
--since=<ref> Only include packages that have been changed since the specified `ref`, e.g. a commit sha or git tag.
--dir-exists=<dirRelativeToPackageRoot> Include only packages where a specific directory exists inside the package.
--file-exists=<fileRelativeToPackageRoot> Include only packages where a specific file exists in the package.
--depends-on=<dependentPackageName> Include only packages that depend on a specific package. This option can be repeated, to further filter the list of packages.
--no-depends-on=<noDependantPackageName> Include only packages that *don't* depend on a specific package. This option can be repeated.
--[no-]include-dependents Include all transitive dependents for each package that matches the other filters. The included packages skip --ignore and --since checks.
--[no-]include-dependencies Include all transitive dependencies for each package that matches the other filters. The included packages skip --ignore and --since checks.
Available commands:
bootstrap Initialize the workspace, link local packages together and install remaining package dependencies. Supports all package filtering options.
clean Clean this workspace and all packages. This deletes the temporary pub & ide files such as ".packages" & ".flutter-plugins". Supports all package filtering options.
exec Execute an arbitrary command in each package. Supports all package filtering options.
list List local packages in various output formats. Supports all package filtering options.
publish Publish any unpublished packages or package versions in your repository to pub.dev. Dry run is on by default.
run Run a script by name defined in the workspace melos.yaml config file.
version Automatically version and generate changelogs based on the Conventional Commits specification. Supports all package filtering options.
Run "melos help <command>" for more information about a command.
A CLI tool for managing Dart & Flutter projects with multiple packages.
Usage: melos <command> [arguments]
Global options:
-h, --help Print this usage information.
--verbose Enable verbose logging.
--no-private Exclude private packages (`publish_to: none`). They are included by default.
--[no-]published Filter packages where the current local package version exists on pub.dev. Or "-no-published" to filter packages that have not had their current version
published yet.
--[no-]nullsafety Filter packages where the current local version uses a "nullsafety" prerelease preid. Or "-no-nullsafety" to filter packages where their current version
does not have a "nullsafety" preid.
--[no-]flutter Filter packages where the package depends on the Flutter SDK. Or "-no-flutter" to filter packages that do not depend on the Flutter SDK.
--scope=<glob> Include only packages with names matching the given glob. This option can be repeated.
--ignore=<glob> Exclude packages with names matching the given glob. This option can be repeated.
--since=<ref> Only include packages that have been changed since the specified `ref`, e.g. a commit sha or git tag.
--dir-exists=<dirRelativeToPackageRoot> Include only packages where a specific directory exists inside the package.
--file-exists=<fileRelativeToPackageRoot> Include only packages where a specific file exists in the package.
--depends-on=<dependentPackageName> Include only packages that depend on a specific package. This option can be repeated, to further filter the list of packages.
--no-depends-on=<noDependantPackageName> Include only packages that *don't* depend on a specific package. This option can be repeated.
--[no-]include-dependents Include all transitive dependents for each package that matches the other filters. The included packages skip --ignore and --since checks.
--[no-]include-dependencies Include all transitive dependencies for each package that matches the other filters. The included packages skip --ignore and --since checks.
Available commands:
bootstrap Initialize the workspace, link local packages together and install remaining package dependencies. Supports all package filtering options.
clean Clean this workspace and all packages. This deletes the temporary pub & ide files such as ".packages" & ".flutter-plugins". Supports all package filtering options.
exec Execute an arbitrary command in each package. Supports all package filtering options.
list List local packages in various output formats. Supports all package filtering options.
publish Publish any unpublished packages or package versions in your repository to pub.dev. Dry run is on by default.
run Run a script by name defined in the workspace melos.yaml config file.
version Automatically version and generate changelogs based on the Conventional Commits specification. Supports all package filtering options.
Run "melos help <command>" for more information about a command.
As you can see - it was printed twice.
I was just about to create an issue when I saw this one describing the same problem.
I have experienced the same issue, also limited to Windows.
I don't see how commands can actually run twice in Melos, are we sure it's not just a case of it printing multiple times but only running once? There's been all sorts of issues with Dart Process
itself on Windows around stdout/stderr/exitCode so this sounds related (for example this)
The logs from the second execution come at the same speed as the first one and don't just appear all at once. The runtime feels like it's twice that of executing the command directly.
Does it happen with the local dev version as well (see main readme) or is it just when it's installed from pub.dev?
I ask as an easy way to check if it's print related or duplicating command related is to modify the print of melos -v to print a random generated string, same string string twice = printing duplicating,
I'm 90% sure it's duplicate printing or something external like pub activate maybe somehow has made multiple copies of melos bin and are being run together (🤷 ), since the -v
is right at the top level of melos with just a simple print
- no processes or similar that could potentially be the issue:
Can you WHERE melos
on cmd and show me what path it points to, and then the contents of the file it points to? Pub usually creates a wrapper bash/batch script to run dart bins - maybe something in there
I just setup and the local dev version and I am not seeing the same issue.
After switching back to the version coming from pub.dev, the issue comes back.
Result of WHERE melos
: \AppData\Local\Pub\Cache\bin\melos.bat
Contents of file:
@echo off
rem This file was created by pub v2.14.4.
rem Package: melos
rem Version: 1.0.0-dev.10
rem Executable: melos
rem Script: melos
if exist "C:\Users\scott\AppData\Local\Pub\Cache\global_packages\melos\bin\melos.dart-2.14.4.snapshot" (
dart "C:\Users\scott\AppData\Local\Pub\Cache\global_packages\melos\bin\melos.dart-2.14.4.snapshot" %*
rem The VM exits with code 253 if the snapshot version is out-of-date.
rem If it is, we need to delete it and run "pub global" manually.
if not errorlevel 253 (
goto error
)
dart pub global run melos:melos %*
) else (
dart pub global run melos:melos %*
)
goto eof
:error
exit /b %errorlevel%
:eof
Given that info, I will close this issue. Thanks for finding that!
OS: Windows 10 Melos: 1.0.0-dev.10
Any command that I run will execute multiple times, and in some cases not terminate (for as long as I let it go at least).
This seems to happen even with
melos -v
ormelos -h
giving the following output:I have this script for testing all packages:
which continuously ran until I terminated it manually.
I have deactivated/re-activated to see if that fixed any issues, as well as tried a few versions (current stable along with the dev releases).
Is there something I am missing potentially?