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

helpers/content.go: call rst2html directly on *nix but via python on windows #5285

Merged
merged 1 commit into from
Oct 11, 2018
Merged

helpers/content.go: call rst2html directly on *nix but via python on windows #5285

merged 1 commit into from
Oct 11, 2018

Conversation

shreyanshk
Copy link
Contributor

Initially, rst2html was called via the python interpreter which would
fail if the script was wrapped in a launcher as on NixOS.
Ideally, on *nix, binaries should be invoked directly to ensure that
shebangs work properly as is being done now.
Handle the case of windows as it doesn't do shebangs.

@shreyanshk
Copy link
Contributor Author

For reference:
#5273
#5167

@bep
Please test on windows as I don't have a windows machine handy.

// handle Windows manually because it doesn't do shebangs
if runtime.GOOS == "windows" {
args := []string{path, "--leave-comments", "--initial-header-level=2"}
result = externallyRenderContent(ctx, python, args)
Copy link

Choose a reason for hiding this comment

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

I also would move python := getPythonExecPath() here because in the other case it is not necessary and could even produce failures.

Copy link
Member

Choose a reason for hiding this comment

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

Agree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There you go.

…windows

Initially, rst2html was called via the python interpreter which would
fail if the script was wrapped in a launcher as on NixOS.
Ideally, on *nix, binaries should be invoked directly to ensure that
shebangs work properly as is being done now.
Handle the case of windows as it doesn't do shebangs.
@bep bep requested a review from anthonyfok October 4, 2018 05:37
@bep bep merged commit 3d4a988 into gohugoio:master Oct 11, 2018
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants