-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh: update DirectCommand to use SshOutputStream
Motivation: as DirectCommand prints the result of the commands to a console it should follow the same rules as AnsiTerminalCommand output (\r\n) Modification: Pull SshOutputStream out of AnsiTerminalCommand and update DirectCommand to use by when printing the output. Result: Correct direct command output if some terminal configurations. Acked-by: Lea Morschel Acked-by: Paul Millar Acked-by: Dmitry Litvintsev Target: master Require-book: no Require-notes: no
- Loading branch information
Showing
3 changed files
with
23 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
modules/dcache/src/main/java/org/dcache/services/ssh2/SshOutputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.dcache.services.ssh2; | ||
|
||
import java.io.FilterOutputStream; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
class SshOutputStream extends FilterOutputStream { | ||
public SshOutputStream(OutputStream out) { | ||
super(out); | ||
} | ||
|
||
@Override | ||
public void write(int c) throws IOException { | ||
if (c == '\n') { | ||
super.write(0xa); | ||
super.write(0xd); | ||
} else { | ||
super.write(c); | ||
} | ||
} | ||
} |