예제 #1
0
        public Task <int> ExecuteCommandAsync(
            [Service] IWebShellFactory webShellFactory,
            ExecuteCommandInput input)
        {
            IWebShell shell = webShellFactory.CreateShell(input.Shell ?? "cmd");

            return(shell.ExecuteAsync(new ShellCommand(input.Command)
            {
                Arguments = input.Arguments,
                WorkDirectory = input.WorkDirectory
            }));
        }
예제 #2
0
        public async Task <CloneGitRepositoryPayload> CloneRepositoryAsync(
            [Service] IWebShellFactory webShellFactory,
            CloneGitRepositoryInput input)
        {
            IWebShell shell = webShellFactory.CreateShell();

            var result = await shell.ExecuteAsync(new ShellCommand("git")
            {
                Arguments     = $"clone {input.Url}",
                WorkDirectory = input.Directory
            });

            var gitPath = input.Url.Split('/').Last().Replace(".git", "");
            var dir     = System.IO.Path.Combine(input.Directory, gitPath);

            return(new CloneGitRepositoryPayload(result, dir));
        }