Skip to content

Process.run() issue on Windows for wrong path on dart 1.2x #31611

Open
@sgrekhov

Description

If, on Windows, file path started with '/' char, then this process can be successfuly run on Dart 2.0 but produces an error on Dart 1.2x. Example is below

import "dart:io";

main() async {
  String executable = Platform.resolvedExecutable;
  String eScript = '/D:/DART/sdk/tests/co19/LibTest/io/Process/start_A01_t01_lib.dart';
  await Process.run(executable, [eScript]).then((ProcessResult results) {
    print(results.stderr);
  });
  print("DONE");
}

The program above works on Dart 2.0 but fails on Dart 1.24 with the following error

Unhandled exception:
Invalid argument(s): Illegal character in path
#0      _Uri._checkWindowsPathReservedCharacters (dart:core/uri.dart:1695)
#1      _Uri._makeWindowsFileUrl (dart:core/uri.dart:1784)
#2      new _Uri.file (dart:core/uri.dart:1663)
#3      _Platform._nativeScript= (dart:io-patch/platform_patch.dart:45)

For Windows, path '/D:/...' is wrong, but, for example, Platform.script.path on Windows returns path in this format. See #31610

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotriagedIssue has been triaged by sub team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions