Fix shell profile powershell commands not being executed in the expected order due to unrecognized new line character
cr
@@ -222,10 +222,14 @@ func (p *ShellPlugin) runShellProfile(log log.T, config agentContracts.Configura
return nil
}
- if _, err := p.stdin.Write([]byte(config.ShellProfile.Windows + shellProfileNewLineCharacter)); err != nil {
+ commands := strings.Split(config.ShellProfile.Windows, "\n")
+
+ for _, command := range commands {
+ if _, err := p.stdin.Write([]byte(command + shellProfileNewLineCharacter)); err != nil {
log.Errorf("Unable to write to stdin, err: %v.", err)
return err
}
+ }
return nil
}
