[ 
https://issues.apache.org/jira/browse/SSHD-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17483896#comment-17483896
 ] 

Lyor Goldstein commented on SSHD-1242:
--------------------------------------

{quote}SSHRuntimeProvider#exec(java.nio.file.Path)
{quote}
There is no such Java equivalent API (including the {{Process}} and {{Runtime}} 
classes you mentioned), nor is it clear what such an API is supposed to do. You 
talk about remote command execution, but the API you suggest accepts a file 
path. Is this a "script" ? Then it is definitely _not_ a remote command 
execution API. Even so, +you+ can easily implement it:
 * Establish an SSH session
 * Read the script line by line
 * Create a {{ChannelExec}}
 * Execute the command - take care to provide it with STDIN, STDOUT, STDERR as 
well as +consuming+ them
 * Parse the results to your heart's content

{quote}what else can we do as a workaround ?
{quote}
Like [~twolf] suggested look at 
[GitSshdSessionProcess|https://github.com/apache/mina-sshd/blob/master/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java]
 and then implement whatever you need, It seems that you have specific needs 
(which do not seem to be well defined) whereas this is a +generic+ project.

> Java SPI for remote command execution
> -------------------------------------
>
>                 Key: SSHD-1242
>                 URL: https://issues.apache.org/jira/browse/SSHD-1242
>             Project: MINA SSHD
>          Issue Type: Question
>    Affects Versions: 2.8.0
>         Environment: Java SE 8, Apache NetBeans IDE 12.5
>            Reporter: dgü
>            Priority: Major
>
> Hello!
> I could use file the system provider for SFTP as defined in SSHD-1238.
> I'm searching a Java service provider for remote command execution. is it 
> available in SSHD ? Or, is there any other API using SSHD for this ?
> Thanks in advance!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to