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(compile): never include the specified output executable in itself #27877

Merged
merged 14 commits into from
Feb 6, 2025

Conversation

HasanAlrimawi
Copy link
Contributor

closes #27796

Change
Check if the output executable file is within the included files to be compiled, and remove it if so.

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.

Thanks! See comment though.

let file_index = include_files.iter().position(|file_included| {
file_included
.path()
.ends_with(output_path.to_str().unwrap().replace(" ", "%20").as_str())
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this will work on windows. It should probably be converted to a url first. Can you add a test for this change?

Copy link
Member

Choose a reason for hiding this comment

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

I investigated this and found out the reason it was working is because output_path happened to be the filename in the tests. I updated it to use the full path instead.

Copy link
Member

Choose a reason for hiding this comment

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

(this won't work on Windows because urls use forward slashes, but windows uses backslashes)

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.

LGTM. Thanks!

@dsherret dsherret enabled auto-merge (squash) February 5, 2025 16:27
@dsherret dsherret merged commit a0c5ef8 into denoland:main Feb 6, 2025
17 checks passed
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.

Deno compile should never include the specified output executable in itself
2 participants