Description
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.