Skip to content

Conversation

@nathanwhit
Copy link
Member

Fixes #31692

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only do this for Node and not Deno’s API due to the extra work necessary and change in behaviour? Also, is it possible for someone to remove the running executable and now this will panic? Maybe we should remove the unwrap?

@nathanwhit
Copy link
Member Author

So I think the thing is the fact that something was spawned with a dx symlink shouldn't really be visible to users. In other words, it should be indistinguishable from an alias in your shell like alias dx="deno x". I think that should be true across deno apis and node apis. Otherwise if you do something like new Deno.Command(Deno.execPath(), { args: ["run", "foo.ts"] }); it would fail because you'd end up with dx run foo.ts which isn't valid. So to make it work you need to canonicalize to the actual deno executable.

We could avoid doing the canonicalization unless it's actually dx? That would avoid the overhead in most cases

@dsherret
Copy link
Member

dx being a symlink to deno sounds problematic for native apis. Does it need to be a symlink? I feel like we should use the same behaviour for aliases of dx that we do for dx

Additionally anything that canonicalizes the dx path before launching dx will break.

@nathanwhit
Copy link
Member Author

It doesn’t need to be, but it’s a common trick to remove the overhead of an extra exec. It’s what bun does for bunx as well. Otherwise you have to do a sh script that does exec deno x $args, which is an extra exec call every time you use dx. The symlink makes the alias effectively free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dx playwright install does not work, but deno run does

2 participants