Closed
Description
This breakage appears under the following conditions:
- The script contains a
package:
import. - The script uses
Isolate.spawn()
. - The script is run from a snapshot.
- The original file that was snapshotted no longer exists.
To reproduce this, create a package with the following files:
// bin.dart
import 'dart:isolate';
main() async {
await Isolate.spawn(entrypoint, null);
}
void entrypoint(_) {
}
Run:
$ dart --snapshot=bin.dart.snapshot bin.dart
$ rm bin.dart
$ dart bin.dart.snapshot
You should see an error like the following:
Unhandled exception:
Load Error for "file:///tmp/app/bin/bin.dart": Error loading file:///tmp/app/bin/bin.dart:
FileSystemException: Cannot open file, path = '/tmp/app/bin/bin.dart' (OS Error: No such file or directory, errno = 2)
#0 _asyncLoadErrorCallback (dart:_builtin:155)
#1 _asyncLoadError (dart:_builtin:566)
#2 _handleLoaderReply (dart:_builtin:383)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
This is a regression. Running git bisect
indicates that this error appeared as of 6d066c7. It's likely related to dart-lang/pub#1379.