diff --git a/CloudKit/Docker/Commands.vb b/CloudKit/Docker/Commands.vb
index 63741f6..9946b19 100644
--- a/CloudKit/Docker/Commands.vb
+++ b/CloudKit/Docker/Commands.vb
@@ -136,14 +136,24 @@ Public Module Commands
' Run 'docker COMMAND --help' for more information on a command.
- ReadOnly powershell As New PowerShell
+ Friend ReadOnly shell As Func(Of String, String, String)
+ Friend ReadOnly logs As New List(Of String)
Public Iterator Function CommandHistory() As IEnumerable(Of String)
- For Each line As String In powershell.logs
+ For Each line As String In logs
Yield line
Next
End Function
+ Sub New()
+ shell = Function(app, args) As String
+ Dim lines As New List(Of String)
+ Call logs.Add($"{app} {args}")
+ Call CommandLine.ExecSub(app, args, onReadLine:=AddressOf lines.Add)
+ Return lines.JoinBy(vbLf)
+ End Function
+ End Sub
+
'''
''' Search the Docker Hub for images
'''
@@ -152,7 +162,7 @@ Public Module Commands
'''
Public Function Search(term As String) As IEnumerable(Of Search)
- Return powershell($"docker search {term}") _
+ Return shell("docker", $"search {term}") _
.ParseTable(Function(tokens)
Return New Search With {
.NAME = Image.ParseEntry(tokens(0)),
@@ -171,7 +181,7 @@ Public Module Commands
'''
Public Function PS() As IEnumerable(Of Container)
- Return powershell("docker ps") _
+ Return shell("docker", "ps") _
.ParseTable(Function(tokens)
Return New Container With {
.CONTAINER_ID = tokens(0).Trim,
@@ -193,7 +203,7 @@ Public Module Commands
Public Sub [Stop](ParamArray containers As String())
For Each id As String In containers
- Call powershell.RunScript($"docker stop {id}")
+ Call shell("docker", $"stop {id}")
Next
End Sub
@@ -217,11 +227,7 @@ Public Module Commands
.Mount(mounts) _
.CreateDockerCommand(command, workdir, portForward)
-#If UNIX = 0 Then
- Return CommandLine.Call("docker", cli.GetTagValue.Value)
-#Else
- Return powershell(cli)
-#End If
+ Return shell("docker", cli)
End Function
'''
@@ -237,7 +243,7 @@ Public Module Commands
Do While (stdout = CommandLine.Call("docker", $"rmi {imageId}")).Contains("image is being used by stopped container")
containerId = Strings.Split(Strings.Trim(stdout)).Last
- Call CommandLine.Call("docker", $"rm {containerId}")
+ Call shell("docker", $"rm {containerId}")
Call Console.WriteLine($"remove container {containerId}")
Loop
diff --git a/CloudKit/Docker/Docker.NET5.vbproj b/CloudKit/Docker/Docker.NET5.vbproj
index fff8775..b100300 100644
--- a/CloudKit/Docker/Docker.NET5.vbproj
+++ b/CloudKit/Docker/Docker.NET5.vbproj
@@ -107,16 +107,13 @@
+
True
-
-
-
-
diff --git a/CloudKit/Docker/Environment.vb b/CloudKit/Docker/Environment.vb
index 8d1e858..5e3e633 100644
--- a/CloudKit/Docker/Environment.vb
+++ b/CloudKit/Docker/Environment.vb
@@ -1,55 +1,56 @@
#Region "Microsoft.VisualBasic::2bc4c7a574db43f6df5da77e267ee513, CloudKit\Docker\Environment.vb"
- ' Author:
- '
- ' asuka (amethyst.asuka@gcmodeller.org)
- ' xie (genetics@smrucc.org)
- ' xieguigang (xie.guigang@live.com)
- '
- ' Copyright (c) 2018 GPL3 Licensed
- '
- '
- ' GNU GENERAL PUBLIC LICENSE (GPL3)
- '
- '
- ' This program is free software: you can redistribute it and/or modify
- ' it under the terms of the GNU General Public License as published by
- ' the Free Software Foundation, either version 3 of the License, or
- ' (at your option) any later version.
- '
- ' This program is distributed in the hope that it will be useful,
- ' but WITHOUT ANY WARRANTY; without even the implied warranty of
- ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ' GNU General Public License for more details.
- '
- ' You should have received a copy of the GNU General Public License
- ' along with this program. If not, see .
+' Author:
+'
+' asuka (amethyst.asuka@gcmodeller.org)
+' xie (genetics@smrucc.org)
+' xieguigang (xie.guigang@live.com)
+'
+' Copyright (c) 2018 GPL3 Licensed
+'
+'
+' GNU GENERAL PUBLIC LICENSE (GPL3)
+'
+'
+' This program is free software: you can redistribute it and/or modify
+' it under the terms of the GNU General Public License as published by
+' the Free Software Foundation, either version 3 of the License, or
+' (at your option) any later version.
+'
+' This program is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with this program. If not, see .
- ' /********************************************************************************/
+' /********************************************************************************/
- ' Summaries:
+' Summaries:
- ' Class Environment
- '
- ' Properties: [Shared], container
- '
- ' Constructor: (+1 Overloads) Sub New
- ' Function: CreateDockerCommand, (+2 Overloads) Mount
- '
- ' Class DockerAppDriver
- '
- ' Constructor: (+1 Overloads) Sub New
- ' Function: Shell
- '
- ' /********************************************************************************/
+' Class Environment
+'
+' Properties: [Shared], container
+'
+' Constructor: (+1 Overloads) Sub New
+' Function: CreateDockerCommand, (+2 Overloads) Mount
+'
+' Class DockerAppDriver
+'
+' Constructor: (+1 Overloads) Sub New
+' Function: Shell
+'
+' /********************************************************************************/
#End Region
Imports System.Runtime.CompilerServices
Imports System.Text
Imports Darwinism.Docker.Arguments
+Imports Microsoft.VisualBasic.CommandLine
Imports Microsoft.VisualBasic.Linq
'''
@@ -249,7 +250,7 @@ Public Class Environment
Call options.AppendLine($"-p {portForward}")
End If
- Return $"docker run {options} {container} {command}"
+ Return $"run {options} {container} {command}"
End Function
End Class
@@ -259,7 +260,6 @@ End Class
Public Class DockerAppDriver
ReadOnly docker As Environment
- ReadOnly powershell As New PowerShell
ReadOnly appHome$
ReadOnly appName$
@@ -278,6 +278,6 @@ Public Class DockerAppDriver
Public Function Shell(args$, Optional workdir$ = Nothing) As String
- Return powershell(docker.CreateDockerCommand($"{appHome}/{appName} {args}", workdir:=workdir))
+ Return Commands.shell("docker", docker.CreateDockerCommand($"{appHome}/{appName} {args}", workdir:=workdir))
End Function
End Class
diff --git a/CloudKit/ossutil/ossutil.NET5.vbproj b/CloudKit/ossutil/ossutil.NET5.vbproj
index ef70821..8dbe7bf 100644
--- a/CloudKit/ossutil/ossutil.NET5.vbproj
+++ b/CloudKit/ossutil/ossutil.NET5.vbproj
@@ -113,10 +113,6 @@
-
-
-
-