Skip to content
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

Closed
DartBot opened this issue Feb 16, 2015 · 7 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior

Comments

@DartBot
Copy link

DartBot commented Feb 16, 2015

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

@DartBot
Copy link
Author

DartBot commented Feb 16, 2015

This comment was originally written by kunalde...@gmail.com


I am trying to make use of this feature in stagehand
https://github.com/google/stagehand/issues/192

@peter-ahe-google
Copy link
Contributor

Removed Area-TryDart label.
Added New label.

@sethladd
Copy link
Contributor

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


cc @munificent.

@sethladd
Copy link
Contributor

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?

@iposva-google
Copy link
Contributor

Added Area-Pub, Triaged labels.

@nex3
Copy link
Member

nex3 commented Feb 18, 2015

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.
cc @mkustermann.
Added AsDesigned label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/pub#1246.

This issue was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

6 participants