forked from mvdan/sh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: fix using Params as an option to New
As correctly pointed out by Marcin Bilski, using the exported function in that way would lead to a panic. And, even after working around the panic, any shell flags used would be overwritten by the first implicit call to Reset. To fix the crash, move the updateExpandOpts method call to the end of the "set" builtin. After all, it's only needed there; the Run function already ends up calling the method later via fillExpandConfig. To keep the shell options from being deleted in Reset, simply whitelist them from the list of fields to clear. We do that for Params, so it follows that the same should happen for the opts field. Finally, add a couple of tests covering both scenarios to TestRunnerOpts. Fixes mvdan#365.
- Loading branch information
Showing
3 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters