You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The client has no support for this today. Like WorkingDirectory, it is a shell-scoped setting: the remote shell is created by the client's first command and reused afterward.
Same contract as workingDirectory(String), documented the same way: honored when the shell is created, i.e. by the client's first command (and every streaming/blocking terminal shares it).
CLI
--env NAME=VALUE, repeatable (winrs-style multiple occurrences), valid for command and the future shell subcommand (#136):
New optional rsp:Environment block in Envelopes.createShell — mind the rsp:Shell child element order (MS-WSMV Shell_Type is a schema sequence: Environment comes before WorkingDirectory, before the stream declarations); verify against a real Windows host, WinRM is picky about this.
Pinning semantics like the working directory (see the reaped-shell fix in Add the fluent WinRMClient API: builders, typed results, unchecked exceptions #133/PR): the environment is pinned by the first command and must be replayed with its ORIGINAL values when the shell is silently recreated after the server reaped it — a recreation must stay invisible.
Values XML-escaped; names validated non-blank; insertion order preserved (LinkedHashMap).
CLI parsing: --env repeatable, NAME=VALUE split on the first =, usage error otherwise; document in the CLI manual.
Tests: wire assertion of the Environment block on Create (FakeWsmanServer), pinned replay on shell recreation, CLI parsing, docs (commands.md + cli.md).
Context
The WSMan shell protocol supports setting environment variables at shell creation: the
rsp:Shellbody of theCreaterequest carriesThe client has no support for this today. Like
WorkingDirectory, it is a shell-scoped setting: the remote shell is created by the client's first command and reused afterward.Proposed API
Same contract as
workingDirectory(String), documented the same way: honored when the shell is created, i.e. by the client's first command (and every streaming/blocking terminal shares it).CLI
--env NAME=VALUE, repeatable (winrs-style multiple occurrences), valid forcommandand the futureshellsubcommand (#136):Requirements
rsp:Environmentblock inEnvelopes.createShell— mind thersp:Shellchild element order (MS-WSMV Shell_Type is a schema sequence:Environmentcomes beforeWorkingDirectory, before the stream declarations); verify against a real Windows host, WinRM is picky about this.--envrepeatable,NAME=VALUEsplit on the first=, usage error otherwise; document in the CLI manual.🤖 Generated with Claude Code