`hugo convert toTOML` not working as expected

Output of hugo env:

Hugo Static Site Generator v0.51 darwin/amd64 BuildDate: 2018-11-07T10:09:45Z
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.11"

Steps to reproduce:

  1. hugo new site yaml-site --format "yaml"
  2. cd yaml-site
  3. hugo new page1.md && hugo new page2.md && hugo new page3.md
  4. hugo convert toTOML

The output of hugo convert toTOML says:

Error: Unsafe operation not allowed, use --unsafe or set a different output path

So I tried: hugo convert toTOML --unsafe, and got output:

processing 3 content files

But when inspecting the front matter of content files, they are still in YAML.

The docs on this command say:

toTOML converts all front matter in the content directory to use TOML for the front matter.


So I think I am missing something obvious here, perhaps additional command flags?

Any help appreciated. Thanks.

Using

Hugo Static Site Generator v0.51 linux/amd64 BuildDate: 2018-11-07T10:10:13Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11"

I am seeing the same result. No change to the files in the content directory.
If I add an --output string for filesystem path to write files to I no longer get

Error: Unsafe operation not allowed

and get the response

processing 3 content files

Hugo still appears to be reading the files but closing them without writing to them.

./yaml-site/content/ OPEN page1.md
./yaml-site/content/ ACCESS page1.md
./yaml-site/content/ CLOSE_NOWRITE,CLOSE page1.md

tryed this with the same result - nothing written, not toml files, not log files!

hugo --unsafe --debug --logFile debug.log --source yaml-site --output toml-site convert toTOML

M:\hugotest>hugo --unsafe --debug --logFile debug.log --source yaml-site --output toml-site convert toTOML
INFO 2018/11/21 09:17:10 No translation bundle found for default language “en”
INFO 2018/11/21 09:17:10 Translation func for language en not found, use default.
INFO 2018/11/21 09:17:10 i18n not initialized; if you need string translations, check that you have a bundle in i18n that matches the site language or the default language.
INFO 2018/11/21 09:17:10 Using config file: M:\hugotest\yaml-site\config.yaml
INFO 2018/11/21 09:17:10 No translation bundle found for default language “en”
INFO 2018/11/21 09:17:10 Translation func for language en not found, use default.
INFO 2018/11/21 09:17:10 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
processing 3 content files

I did test this before the 0.51 (I rewrote the page parser and front matter handlering) – but It seems I have since then broken it. This is a lesson about always adding tests when touching old functionality.

Can you create a GH issue about this?

Sure, here you go: