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

fix: use current deno executable even when not named deno #123

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: denoland/setup-deno@v1
with:
deno-version: canary
- uses: dsherret/rust-toolchain-file@v1

- uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.DENOBOT_PAT }}

- uses: denoland/setup-deno@v1
with:
deno-version: canary
- uses: dsherret/rust-toolchain-file@v1

- name: Tag and release
Expand All @@ -34,4 +36,4 @@ jobs:
run: |
git config user.email "denobot@users.noreply.github.com"
git config user.name "denobot"
deno run -A https://raw.githubusercontent.com/denoland/automation/0.14.1/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
deno run -A https://raw.githubusercontent.com/denoland/automation/0.20.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
4 changes: 2 additions & 2 deletions src/shell/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ async fn cross_platform_shebang() {
// without -S, but valid
TestBuilder::new()
.file("file.ts", "#!/usr/bin/env ./echo_stdin.ts\nconsole.log('Hello')")
.file("echo_stdin.ts", "#!/usr/bin/env -S deno run --allow-run\nawait new Deno.Command('deno', { args: ['run', ...Deno.args] }).spawn();")
.file("echo_stdin.ts", "#!/usr/bin/env -S deno run --allow-all\nawait new Deno.Command('deno', { args: ['run', ...Deno.args] }).spawn();")
.command("./file.ts")
.assert_stdout("Hello\n")
.run()
Expand All @@ -1454,7 +1454,7 @@ async fn cross_platform_shebang() {
TestBuilder::new()
.directory("sub")
.file("sub/file.ts", "#!/usr/bin/env ../echo_stdin.ts\nconsole.log('Hello')")
.file("echo_stdin.ts", "#!/usr/bin/env -S deno run --allow-run\nawait new Deno.Command('deno', { args: ['run', ...Deno.args] }).spawn();")
.file("echo_stdin.ts", "#!/usr/bin/env -S deno run --allow-all\nawait new Deno.Command('deno', { args: ['run', ...Deno.args] }).spawn();")
.command("./sub/file.ts")
.assert_stdout("Hello\n")
.run()
Expand Down
5 changes: 4 additions & 1 deletion src/shell/which.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ pub fn resolve_command_path<'a>(
// this condition exists to make the tests pass because it's not
// using the deno as the current executable
let file_stem = exe_path.file_stem().map(|s| s.to_string_lossy());
if file_stem.map(|s| s.to_string()) == Some("deno".to_string()) {
if file_stem
.map(|s| !s.starts_with("deno_task_shell-"))
.unwrap_or(true)
{
return Ok(exe_path);
}
}
Expand Down