Skip to content

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

Merged
bep merged 1 commit into
gohugoio:masterfrom
shreyanshk:master
Oct 11, 2018
Merged

helpers/content.go: call rst2html directly on *nix but via python on windows#5285
bep merged 1 commit into
gohugoio:masterfrom
shreyanshk:master

Conversation

@shreyanshk

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

For reference:
#5273
#5167

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

Comment thread helpers/content.go
// 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
Copy Markdown

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree.

Copy link
Copy Markdown
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

github-actions Bot commented Feb 2, 2022

Copy link
Copy Markdown

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