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

Support shebangs #1197

Merged
merged 2 commits into from
Nov 16, 2018
Merged

Support shebangs #1197

merged 2 commits into from
Nov 16, 2018

Conversation

ry
Copy link
Member

@ry ry commented Nov 15, 2018

Fixes #929

@kitsonk
Copy link
Contributor

kitsonk commented Nov 15, 2018

I suspect this is going to need an integration test and more changes as TypeScript doesn't like files without extensions.

Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

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

Lgtm

@ry
Copy link
Member Author

ry commented Nov 16, 2018

@kitsonk probably right - but initial tests worked. We can nail down further problems as they arise.

@ry ry merged commit f88fa2d into denoland:master Nov 16, 2018
ry added a commit to ry/deno that referenced this pull request Nov 16, 2018
Changes since v0.1.12:
- First pass at running subprocesses (denoland#1156)
- Improve flag parsing (denoland#1200)
- Improve fetch() (denoland#1194 denoland#1188 denoland#1102)
- Support shebang (denoland#1197)
@ry ry mentioned this pull request Nov 16, 2018
ry added a commit that referenced this pull request Nov 16, 2018
Changes since v0.1.12:
- First pass at running subprocesses (#1156)
- Improve flag parsing (#1200)
- Improve fetch() (#1194 #1188 #1102)
- Support shebang (#1197)
@kuboon
Copy link

kuboon commented Nov 15, 2020

how can I use this feature?

@kitsonk
Copy link
Contributor

kitsonk commented Nov 15, 2020

There is nothing you need to do to use the feature. Source files are stripped of shebangs before they are used.

@tracker1
Copy link

The following doesn't work... file test.ts

#!/usr/bin/env deno

console.log("test");

run via chmod +x ./test.ts then ./test.ts

@tracker1
Copy link

Okay, looks like I need...

#!/usr/bin/env -S deno -q run
// deno-language: ts

console.log("test");

without a file extension...

@aiotter
Copy link

aiotter commented Dec 11, 2021

@tracker1 You were telling incorrect information.
I greped all the source codes in this repo and found no deno-language option.
What made you write // deno-language: ts?

I wrote the following code and save it as denotest to get a parse error:

#!/usr/bin/env -S deno -q run
// deno-language: ts

function echo(input: string) {
  console.log(input);
}

echo("Hello, world!");

Renaming denotest to denotest.ts fixed it.

To my understanding, deno currently has no option to run a extension-less interpreter files written in TS.
See ongoing discussion at #5088.

@aiotter
Copy link

aiotter commented Dec 11, 2021

Oh wait, I found @tracker1 edited this Stack Overflow post to show the incorrect information there: https://stackoverflow.com/posts/63044107/revisions

Please don't do this! Check your knowledge before you teach someone.
I strongly recommend you re-editing the post so that they won't waste their time.
I tried to send an edit request, but I wasn't able to because suggested edit queue was already full.

It seems @martin-braun is one of the victims (denoland/vscode_deno#475 (comment)).

@martin-braun
Copy link

martin-braun commented Dec 12, 2021

@aiotter Thanks for mentioning me and reminding me about that. I previously found #5088 and learned that it is not implemented yet, but I forgot to edit my issue on vscode_deno. I edited my GitHub issue and I also removed the misinformation from dwmorrin's answer at StackOverflow to prevent further confusion in the community.

@aiotter
Copy link

aiotter commented Dec 12, 2021

Thanks @martin-braun! I appreciate your help to remove the misinformation. Nice work!

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.

shebang support
7 participants