Preventing environment variable expansion in windows displays unexpected output
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 133
- Forks
- 73
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 2
Description
I tried to track down the root cause of this but was unable to in the time I had available.
In cmd.exe, running this echo %^COMPUTERNAME% outputs %COMPUTERNAME%
In mixlib/shellout, running
blah = Mixlib::ShellOut.new("echo %^COMPUTERNAME%")
blah.run_command.stdout
outputs %^COMPUTERNAME%. I would expect the carat to be removed like it is in cmd.exe.
The end result of this behavior is that I can't run commands that expected unexpanded environment variables as arguments.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The behavior is exposed through Mixlib::ShellOut in mixlib/shellout; start by tracing how Windows commands are executed and how stdout is collected. Compare echo %^COMPUTERNAME% with cmd.exe, then verify that the caret is removed while the environment variable remains unexpanded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100