Pass through the env to file.patch state

Fixes #7452.
Merge pull request #7476 from terminalmage/issue7452

Pass through the env to file.patch state