public void Start(IEnumerable <string> arguments, [CallerMemberName] string name = null)
        {
            if (!_prepared)
            {
                throw new InvalidOperationException($"Call {nameof(PrepareAsync)} first");
            }

            var args = new List <string>
            {
                Scenario.DotNetWatchPath,
            };

            args.AddRange(arguments);

            var spec = new ProcessSpec
            {
                Executable           = DotNetMuxer.MuxerPathOrDefault(),
                Arguments            = args,
                WorkingDirectory     = SourceDirectory,
                EnvironmentVariables =
                {
                    ["DOTNET_CLI_CONTEXT_VERBOSE"]      = bool.TrueString,
                    ["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(),
                },
            };

            Process = new AwaitableProcess(spec, _logger);
            Process.Start();
        }
Beispiel #2
0
        public void Start(IEnumerable <string> arguments, [CallerMemberName] string name = null)
        {
            if (!_prepared)
            {
                throw new InvalidOperationException($"Call {nameof(PrepareAsync)} first");
            }

            var args = new List <string>
            {
                Scenario.DotNetWatchPath,
            };

            args.AddRange(arguments);

            var dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes <AssemblyMetadataAttribute>()
                             .Single(s => s.Key == "DotnetPath").Value;

            var spec = new ProcessSpec
            {
                Executable           = dotnetPath,
                Arguments            = args,
                WorkingDirectory     = SourceDirectory,
                EnvironmentVariables =
                {
                    ["DOTNET_CLI_CONTEXT_VERBOSE"]      = bool.TrueString,
                    ["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(),
                    ["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName,
                },
            };

            Process = new AwaitableProcess(spec, _logger);
            Process.Start();
        }
Beispiel #3
0
        public void Start(IEnumerable <string> arguments, [CallerMemberName] string name = null)
        {
            if (!_prepared)
            {
                throw new InvalidOperationException($"Call {nameof(PrepareAsync)} first");
            }

            var args = new List <string>
            {
                Scenario.DotNetWatchPath,
            };

            args.AddRange(DotnetWatchArgs);
            args.AddRange(arguments);

            var dotnetPath = "dotnet";

            // Fallback to embedded path to dotnet when not on helix
            if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
            {
                dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes <AssemblyMetadataAttribute>()
                             .Single(s => s.Key == "DotnetPath").Value;
            }

            var spec = new ProcessSpec
            {
                Executable           = dotnetPath,
                Arguments            = args,
                WorkingDirectory     = SourceDirectory,
                EnvironmentVariables =
                {
                    ["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(),
                    ["__DOTNET_WATCH_RUNNING_AS_TEST"]  = "true",
                },
            };

            foreach (var env in EnvironmentVariables)
            {
                spec.EnvironmentVariables.Add(env.Key, env.Value);
            }

            if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
            {
                spec.EnvironmentVariables["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName;
            }

            Process = new AwaitableProcess(spec, _logger);
            Process.Start();
        }