fix bugs of run command in linux system

master
xieguigang 6 years ago
parent c1a2daa306
commit a67979d35f

@ -33,7 +33,7 @@ Public Class PuTTY
''' https://stackoverflow.com/questions/57778301/hyper-v-powershell-run-a-bash-command-in-linux-vm-and-get-output
''' </remarks>
Public Function Run(bash As String) As String
Dim cli As String = $"{endpoint} -P {port} -l {user} -pw ""{password}"" -batch bash ""{bash}"""
Dim cli As String = $"{endpoint} -P {port} -l {user} -pw ""{password}"" -batch /bin/bash ""{bash}"""
Dim std_out As String = CommandLine.Call(plink, cli)
Return std_out
@ -41,7 +41,7 @@ Public Class PuTTY
Public Function Shell(command As String, Optional arguments As String = Nothing) As String
Dim cmdl As String = If(arguments.StringEmpty, command, $"{command} {arguments}")
Dim cli As String = $"{user}@{endpoint} -P {port} -pw ""{password}"" bash -c ""{cmdl}"""
Dim cli As String = $"{user}@{endpoint} -P {port} -pw ""{password}"" -batch {cmdl}"
Dim std_out As String = CommandLine.Call(plink, cli)
Return std_out

@ -72,7 +72,8 @@ Module Module1
Sub testPuTTY()
Dim ssh As New PuTTY("xcms", "12345", "192.168.1.253")
Call Console.WriteLine(ssh.Shell("ls", "-l /bin"))
Call Console.WriteLine(ssh.Shell("ls", "-l /mnt/smb/tmp/test_watcher/p+n/neg/mzML"))
Call Console.WriteLine(ssh.Shell("Rscript", "-e \""biodeep::run.Deconvolution(raw = '/mnt/smb/tmp/test_watcher/p+n/neg/mzML');\"""))
Pause()
End Sub

Loading…
Cancel
Save