Fix incorrect `execute_command` defaults in shell-local pp docs

This commit is contained in:
DanHam 2019-08-05 15:47:01 +01:00
parent 8ddbb791a1
commit 66b5b9f8c5
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
1 changed files with 23 additions and 12 deletions

View File

@ -68,18 +68,29 @@ Optional parameters:
it is necessary below.
- `execute_command` (array of strings) - The command used to execute the
script. By default this is `["/bin/sh", "-c", "{{.Vars}}", "{{.Script}}"]`
on unix and `["cmd", "/c", "{{.Vars}}", "{{.Script}}"]` on windows. This is
treated as a [template engine](/docs/templates/engine.html). There are two
available variables: `Script`, which is the path to the script to run, and
`Vars`, which is the list of `environment_vars`, if configured. If you
choose to set this option, make sure that the first element in the array is
the shell program you want to use (for example, "sh" or
"/usr/local/bin/zsh" or even "powershell.exe" although anything other than
a flavor of the shell command language is not explicitly supported and may
be broken by assumptions made within Packer). It's worth noting that if you
choose to try to use shell-local for Powershell or other Windows commands,
the environment variables will not be set properly for your environment.
script. By default, on *nix systems this is:
```
["/bin/sh", "-c", "{{.Vars}} {{.Script}}"]
```
While on Windows, `execute_command` defaults to:
```
["cmd", "/V", "/C", "{{.Vars}}", "call", "{{.Script}}"]
```
This is treated as a [template engine](/docs/templates/engine.html).
There are two available variables: `Script`, which is the path to the
script to run, and `Vars`, which is the list of `environment_vars`, if
configured. If you choose to set this option, make sure that the first
element in the array is the shell program you want to use (for example,
"sh" or "/usr/local/bin/zsh" or even "powershell.exe" although anything
other than a flavor of the shell command language is not explicitly
supported and may be broken by assumptions made within Packer). It's
worth noting that if you choose to try to use shell-local for
Powershell or other Windows commands, the environment variables will
not be set properly for your environment.
For backwards compatibility, `execute_command` will accept a string instead
of an array of strings. If a single string or an array of strings with only