-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Isolate.spawnUri does not load dart file from another directory when running as global package #22436
Comments
This comment was originally written by kunalde...@gmail.com I am trying to make use of this feature in stagehand |
Removed Area-TryDart label. |
This is an unfortunate side effort of running inside of pub run. I advise that you do not support this use case, and just run the commend via cc @munificent. |
However, I think pub has some code to use spawnUri to get code from other packages? So maybe there's a pattern we can use? |
Pub doesn't provide guarantees about the relative locations of a package's files across various usage models. This is important to allow it freedom to make the package's executables as efficient and usable as possible; here, for example, pub is compiling your executable to a snapshot, which means slurping all of its code together into a single file. There's no way to put that file in the exact same place as the original executable without breaking other parts of the system. Eventually there's a plan to provide a general way of locating a package's assets, including source files. I know Søren and Martin were thinking about that a while ago, but I don't know if any code exists yet. cc @sgjesse. |
This issue has been moved to dart-lang/pub#1246. |
This issue was originally filed by kunaldeo200...@gmail.com
What steps will reproduce the problem?
Future<Isolate> remote = Isolate.spawnUri(Uri.parse("../../stagehandData/isloader.dart"), [""], response.sendPort);
When the project containing this code is installed as a global package ( pub global activate -s path projdirectory). It gives an error.
What is the expected outcome?
Above line works when used as a regular dart application. It gives exception as a globally installed pub package as well.
What do you see instead?
Unhandled exception:
Uncaught Error: Failure getting http://localhost:54062/stagehandData/isloader.dart: 404 Not Found
Stack Trace:
0 _asyncLoadError (dart:_builtin:285)
1 _httpGet.<anonymous closure>.<anonymous closure> (dart:_builtin:228)
2 _RootZone.runGuarded (dart:async/zone.dart:1082)
3 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
4 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
5 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:290)
6 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:112)
Which Dart are you using?
Dart 1.8.5
The text was updated successfully, but these errors were encountered: