Skip to content

[native_assets] Process.start hangs when executed in build method on Windows. #2077

Closed
@MichealReed

Description

@MichealReed

Reproduction:

  1. Navigate to any native assets example.
  2. From the root of the example directory git clone https://github.com/google/dawn.git
  3. At the top of the hooks/build.dart build method add.
  4. If you kill the process with CTRL + C and repeat, you will see many detached processes like cl.exe, msbuild.exe, and cmake.exe start to accumulate, but that may relate to github.com/Child processes remain after parent termination on Windows sdk#49234.
    final sourceDir = Directory('./dawn');

    final process = await Process.start("cmake", [
      "--log-level",
      "TRACE",
      "-S",
      ".",
      "-B",
      "build_test",
      "-Wno-dev",
    ], workingDirectory: sourceDir.path);

    process.stdout.transform(utf8.decoder).listen((data) {
      stderr.writeln(data);
    });
    process.stderr.transform(utf8.decoder).listen((data) {
      stderr.writeln(data);
    });

    await process.exitCode;

Now in a isolate directory,

  1. git clone https://github.com/google/dawn.git (or another large cmake project)
  2. add a file to the root of the dawn directory build_dawn.dart
  3. dart -v run build_dawn.dart with the code below
// build_dawn.dart
import "dart:io";
void main(List<String> arguments) {
    final process = await Process.run('cmake', [
    '--log-level',
    'TRACE',
    '-S',
    '.',
    '-B',
    'build',
    '-Wno-dev',
  ]);
  process.stdout.transform(utf8.decoder).listen((data) {
    stdout.writeln(data);
  });
  await process.exitCode;
}

The process will not get stuck and will complete.

Any ideas why Process.start would work differently in the native_assets build hook on Windows?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions