protected Process StartRunner(string shadowDirectory, string[] sourceDirecties, string[] args) { ShadowFileCopier.Copy(sourceDirecties, shadowDirectory, true, filesunchangedWaitingTimeMilliseconds: 500); var runnerPath = Path.Combine(shadowDirectory, @"FileEtl.Runner.exe"); var start = new ProcessStartInfo { FileName = Path.Combine(shadowDirectory, @"FileEtl.Runner.exe"), UseShellExecute = true, //WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, #if DEBUG Arguments = string.Join(" ", args, "--debug") #else Arguments = string.Join(" ", args) #endif }; var process = new Process(); process.StartInfo = start; process.Start(); return(process); } }
private static void StartProcessInShadowCopyAndWaitForExit() { var id = Guid.NewGuid(); var shadowdirectory = Shadowdirectory(hostedProcess.Id); if (!Directory.Exists(shadowdirectory)) { Directory.CreateDirectory(shadowdirectory); } while (ShadowFileCopier.FilesChanged(new string[] { SourceDirectory }, shadowdirectory)) { ShadowFileCopier.Copy(new string[] { SourceDirectory }, shadowdirectory); Thread.Sleep(5000); } var infolder = @"D:\temp\FileEtl-Runner"; var start = new ProcessStartInfo { FileName = Path.Combine(shadowdirectory, @"FileEtl.Runner.exe"), // To run as command line with io UseShellExecute = true, //WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, Arguments = $@"{id} ""{infolder}""" }; var process = new Process(); process.StartInfo = start; process.Start(); processIsRunning = true; }