core/binstub_sdk_check library
Detects when pub's fdb launcher was written for a different Dart SDK
than the one running fdb.
dart pub global activate writes PUB_CACHE/bin/fdb, which runs
PUB_CACHE/global_packages/fdb/bin/fdb.dart-X.Y.Z.snapshot (X.Y.Z = the
activating SDK) with whatever dart is on PATH. When those differ, the VM
prints Can't load Kernel binary, and the launcher falls back to
dart pub global run, which is what ends up running fdb. fdb only reads
the launcher to explain that line; it never writes to the pub cache.
Constants
- launcherMarker → const String
- Line in the launcher that some earlier fdb builds wrote over pub's. That launcher picks the right snapshot itself, so it gets no warning and is left as is.
Functions
-
binstubSdkCheckInputFromPlatform(
) → BinstubSdkCheckInput - Builds a BinstubSdkCheckInput from the real process environment.
-
checkBinstubSdk(
BinstubSdkCheckInput input) → BinstubSdkMismatch? -
Returns the mismatch when fdb runs from a global activation and
PUB_CACHE/bin/fdbhardcodes another SDK's snapshot; otherwise null. Reads files only; never throws.
Typedefs
- BinstubSdkCheckInput = ({bool isWindows, String? pubCacheDir, String runningDartVersion, String scriptPath})
- BinstubSdkMismatch = ({String activated, String running})
-
activatedis the SDK the launcher hardcodes,runningthe current one.