Skip to content

-c hangs instead of erroring when the command exceeds cmd.exe's line limit #3

Description

@ale-rinaldi

Split out of #1 (residual finding reported there after the v1.3.8 fix).

Summary

On a Windows agent, a -c command whose wrapped line exceeds cmd.exe's limit
makes dwshell wait for output that can never arrive: it burns the whole
--timeout and then reports

dwshell: timed out waiting for command to finish

and with the default (no --timeout) it waits forever. Nothing indicates that
the length is the cause.

Mechanism

cmd.exe truncates a typed line past 8190 characters — verified against a
live Windows agent, 8190 passes and 8191 does not, deterministically.

The truncation is silent. Instrumenting the raw terminal stream over an
over-long line shows the __DWSH_BEGIN__ marker arriving and the prompt coming
back, with no error text of any kind — the command is executed truncated, and
what gets cut off the end is exactly dwshell's __DWSH_RC_%errorlevel%_END__
sentinel. dwshell then waits for a marker that will never be sent.

So there is no remote error message to surface here: cmd.exe emits none.

Fix

Reject the command up front, before connecting the shell, with a message that
names the limit and the way around it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions