Skip to content

Commit

Permalink
Fixup "netcat does not support -U option"
Browse files Browse the repository at this point in the history
Some nc implementations print help to stdout, others to stderr.

ymnk#31
ymnk#32
  • Loading branch information
tristanlins committed Mar 9, 2020
1 parent 86bdeca commit 84952aa
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ public NCUSocketFactory() throws AgentProxyException {
Process p = null;
StringBuilder sb = new StringBuilder();
try {
p = Runtime.getRuntime().exec("nc -h");
InputStream is = p.getErrorStream();
p = new ProcessBuilder()
.command("nc", "-h")
.redirectErrorStream(true)
.start();
InputStream is = p.getInputStream();
byte[] buf = new byte[1024];
int i = 0;
while((i = is.read(buf, 0, buf.length))>0){
Expand Down

0 comments on commit 84952aa

Please sign in to comment.