Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate.spawnUri does not load dart file from another directory when running as global package #1246

Closed
DartBot opened this issue Jun 5, 2015 · 6 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

Originally opened as dart-lang/sdk#22436

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 Jun 5, 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

@DartBot DartBot added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) closed-as-intended Closed as the reported issue is expected behavior labels Jun 5, 2015
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5689005?v=3" align="left" width="48" height="48"hspace="10"> Comment by peter-ahe-google


Removed Area-TryDart label.
Added New label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


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.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


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?

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5449880?v=3" align="left" width="48" height="48"hspace="10"> Comment by iposva-google


Added Area-Pub, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant