Non-interactive command should not use shlex to split commands on windows
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
See https://github.com/aws/amazon-ssm-agent/blob/7d0a6c29e6a44004830adb2d4052e2f4f63fa9f8/agent/session/shell/shell_windows.go#L167
```go
func (p *ShellPlugin) startExecCmd(finalCmd string, log log.T, config agentContracts.Configuration) (err error) {
var cmd *exec.Cmd
commands, err := shlex.Split(finalCmd)
if err != nil {
return fmt.Errorf("Failed to parse commands input: %s\n", err)
}
if len(commands) > 0 {
cmd = exec.Command(winptyCmd, commands[0:]...)
} else {
cmd = exec.Command(winptyCmd)
}
```
shlex is designed for linux, not windows, and so this causes very weird parsing errors.
Contributor guide
Research direction
Read agent/session/shell/shell_windows.go at startExecCmd, especially the shlex.Split and exec.Command calls. Confirm how non-interactive Windows commands are parsed and identify the relevant Windows shell tests or reproduction path. Done means Windows command input no longer uses Linux-oriented shlex parsing and the reported parsing errors are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100