From a67979d35fa08b3bd669f0d62b12eff3b9aef004 Mon Sep 17 00:00:00 2001 From: xieguigang Date: Wed, 2 Dec 2020 16:50:02 +0800 Subject: [PATCH] fix bugs of run command in linux system --- Centos/PuTTY.vb | 4 ++-- Docker/test/Module1.vb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Centos/PuTTY.vb b/Centos/PuTTY.vb index 59d2037..e402b5e 100644 --- a/Centos/PuTTY.vb +++ b/Centos/PuTTY.vb @@ -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 ''' 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 diff --git a/Docker/test/Module1.vb b/Docker/test/Module1.vb index f5a462c..b06218f 100644 --- a/Docker/test/Module1.vb +++ b/Docker/test/Module1.vb @@ -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