Skip to content

New API: dart:io.Platform.resolvedDartTool #60724

Open
@srawlins

Description

@srawlins

Developers sometimes rely on Platform.resolvedExecutable to find the "running" dart command on which a script is running. Then you can run, for example, Process.start(Platform.resolvedExecutable, ['pub', 'get']). This works when the running script is being run as JIT, with dart or dart.exe as the resolved executable.

But for a script which is compiled with AOT, Platform.resolvedExecutable resolves to dartaotruntime. And dartaotruntime pub get does not work. In order to compatibly use a dart binary, for example to run pub get, you can use the dart sibling to Platform.resolvedExecutable (or the dart.exe sibling).

It would be nice to expose this executable as a static getter on Platform. Maybe dartExecutable or dartTool (dart --help describes itself as a "utility". The website docs call dart "The Dart command-line tool".

Developers of analyzer plugins may need to be aware of this as analyzer is compiled AOT. See #50498.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions