Support Spring Shell 3.3+
When using Spring Shell 3.3.x, the call at https://github.com/fonimus/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/SshShellRunnable.java#L160 matches https://github.com/spring-projects/spring-shell/blob/v3.3.4/spring-shell-core/src/main/java/org/springframework/shell/ShellRunner.java#L51 instead of https://github.com/spring-projects/spring-shell/blob/v3.3.4/spring-shell-core/src/main/java/org/springframework/shell/jline/InteractiveShellRunner.java#L69.
This leads to ChannelSession[id=0, recipient=0]-ServerSessionImpl[<REDACTED>]: unexpected exception with stack trace:
java.lang.UnsupportedOperationException: Should get implemented together with canRun
at org.springframework.shell.ShellRunner.run(ShellRunner.java:52)
at com.github.fonimus.ssh.shell.SshShellRunnable.run(SshShellRunnable.java:160)
at java.base/java.lang.Thread.run(Unknown Source)
I was getting ready to attempt to contribute a fix, but after cloning the repo and running tests, I'm seeing:
[ERROR] Errors:
[ERROR] SystemCommandTest.threads:54 » NullPointer Cannot enter synchronized block because "lock" is null
[INFO]
[ERROR] Tests run: 203, Failures: 0, Errors: 1, Skipped: 0
Even if disabling the test, it's not enough to just fix the call mentioned above. More work is necessary. Maybe related to other changes in Spring Shell like https://github.com/spring-projects/spring-shell/wiki/Spring-Shell-3.3-Release-Notes
I just made a PR for the upgrade. Also stumbled over this NPE. It is due to the writer is a mock object. I used a real PrintWriter for this test to get the unit test working:
https://github.com/fonimus/ssh-shell-spring-boot/pull/403/files#diff-544d926e3e353f5b2fe95d7f03803cbb8f77ad8b1bdee8d5a52a7b5c784db651