Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpc-workflow-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIJI
hpc-workflow-manager
Commits
c08feda1
Commit
c08feda1
authored
6 years ago
by
Jan Kožusznik
Browse files
Options
Downloads
Patches
Plain Diff
add forward support
parent
26f24b7f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java-scpclient/src/main/java/cz/it4i/fiji/scpclient/SshCommandClient.java
+17
-4
17 additions, 4 deletions
...rc/main/java/cz/it4i/fiji/scpclient/SshCommandClient.java
with
17 additions
and
4 deletions
java-scpclient/src/main/java/cz/it4i/fiji/scpclient/SshCommandClient.java
+
17
−
4
View file @
c08feda1
...
@@ -8,6 +8,8 @@ import com.jcraft.jsch.JSchException;
...
@@ -8,6 +8,8 @@ import com.jcraft.jsch.JSchException;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -35,8 +37,8 @@ public class SshCommandClient extends AbstractBaseSshClient {
...
@@ -35,8 +37,8 @@ public class SshCommandClient extends AbstractBaseSshClient {
super
(
hostName
,
userName
,
keyFile
,
pass
);
super
(
hostName
,
userName
,
keyFile
,
pass
);
}
}
public
String
executeCommand
(
String
command
)
{
public
List
<
String
>
executeCommand
(
String
command
)
{
String
Builder
sb
=
new
StringBuilder
();
List
<
String
>
result
=
new
LinkedList
<>
();
try
{
try
{
ChannelExec
channelExec
=
(
ChannelExec
)
getConnectedSession
().
openChannel
(
ChannelExec
channelExec
=
(
ChannelExec
)
getConnectedSession
().
openChannel
(
"exec"
);
"exec"
);
...
@@ -50,7 +52,7 @@ public class SshCommandClient extends AbstractBaseSshClient {
...
@@ -50,7 +52,7 @@ public class SshCommandClient extends AbstractBaseSshClient {
String
line
;
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
).
append
(
'\n'
);
result
.
add
(
line
);
}
}
int
exitStatus
=
channelExec
.
getExitStatus
();
int
exitStatus
=
channelExec
.
getExitStatus
();
...
@@ -70,6 +72,17 @@ public class SshCommandClient extends AbstractBaseSshClient {
...
@@ -70,6 +72,17 @@ public class SshCommandClient extends AbstractBaseSshClient {
log
.
error
(
"Error: "
,
e
);
log
.
error
(
"Error: "
,
e
);
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
return
sb
.
toString
();
return
result
;
}
public
boolean
setPortForwarding
(
int
lport
,
String
rhost
,
int
rport
)
{
try
{
getConnectedSession
().
setPortForwardingL
(
lport
,
rhost
,
rport
);
}
catch
(
JSchException
exc
)
{
log
.
error
(
"forward"
,
exc
);
return
false
;
}
return
true
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment