I joined a project which utilizes Java to execute SSH commands, I'm trying to run a test suite on localhost. Short commands are executed properly. Running longer commands is a challenge, though. An SSH command is built, it looks like this:
ssh -v username@localhost bash -c "long-command"
Where long-command is about 2000 characters in length - it contains a list of encoded values and I can't change this fact without major changes in project's architecture. In Java long-command is reflected properly and uncut as far as I can check using debugger, it's passed to ProcessBuilder. The errorlog of SSH command execution says however:
debug1: Sending command: bash -c long-command-cut-in-half
Command's length (measured starting from "bash" keyword) can only reach 900 characters. Anything past this number is lost, which makes the command invalid.
I'm using Bitvise SSH Server on Windows, ssh.exe comes from OpenSSH installed as an optional function in Windows 10 - results were the same when using ssh.exe delivered with Git - and have Cygwin installed.
The command should surely be shorter, but it doesn't exceed OS limit. I've been looking for an answer for a while: why is this happening?