public ProcessInfo Wrap(ProcessInfo processInfo) => new ProcessInfo( "wsl", processInfo.WorkingDirectory, new [] { new CommandLineArgument(processInfo.Executable.Value) }.Concat(processInfo.Arguments), Enumerable.Empty <EnvironmentVariable>());
public ProcessInfo Wrap(ProcessInfo processInfo) => new ProcessInfo( "docker", processInfo.WorkingDirectory, _dockerArgumentsProvider.GetArguments(_wrapperInfo, processInfo), processInfo.Variables);
public IEnumerable <CommandLineArgument> GetArguments(DockerWrapperInfo wrapperInfo, ProcessInfo processInfo) { yield return("run"); yield return("-it"); if (wrapperInfo.AutomaticallyRemove) { yield return("--rm"); } yield return("--platform"); switch (wrapperInfo.Platform) { case OperatingSystem.Windows: yield return("windows"); break; case OperatingSystem.Unix: yield return("linux"); break; case OperatingSystem.Mac: throw new NotSupportedException(); default: throw new ArgumentOutOfRangeException(); } switch (wrapperInfo.Pull) { case DockerPullType.Missing: break; case DockerPullType.Always: yield return("--pull"); yield return("always"); break; case DockerPullType.Never: yield return("--pull"); yield return("never"); break; default: throw new ArgumentOutOfRangeException(); } if (!processInfo.WorkingDirectory.IsEmpty) { yield return($"--workdir={_pathNormalizer().Normalize(processInfo.WorkingDirectory)}"); } var args = new[] { _dockerEnvironmentArgumentsProvider, _dockerVolumesArgumentsProvider } .SelectMany(i => i.GetArguments(wrapperInfo, processInfo)); foreach (var arg in args) { yield return(arg); } foreach (var argument in wrapperInfo.Arguments) { yield return(argument); } yield return(wrapperInfo.Image.Name); yield return(processInfo.Executable.Value); foreach (var arg in processInfo.Arguments) { yield return(arg); } }
public IEnumerable <CommandLineArgument> GetArguments(DockerWrapperInfo wrapperInfo, ProcessInfo processInfo) { if (wrapperInfo.EnvironmentVariables.Any()) { _fileSystem.WriteLines(_envFilePath, wrapperInfo.EnvironmentVariables.Select(i => $"{i.Name}=\"{i.Value}\"")); yield return("--env-file"); yield return(_envFilePath.Value); } }
public IEnumerable <CommandLineArgument> GetArguments(DockerWrapperInfo wrapperInfo, ProcessInfo processInfo) { foreach (var volume in GetVolumes(wrapperInfo, processInfo)) { yield return("-v"); yield return($"{volume.HostPath.Value}:{_pathNormalizer().Normalize(volume.ContainerPath).Value}"); } }