Exemple #1
0
            public void Stop_StillWorks_Eventually()
            {
                Container1 = CreateContainer(Container1Handle);
                string userid = null;

                Container1.ImpersonateContainerUser(() =>
                {
                    userid = WindowsIdentity.GetCurrent().User.ToString();
                });
                var pSpec = new ProcessSpec
                {
                    ExecutablePath     = "cmd.exe",
                    DisablePathMapping = true,
                    Arguments          = new string[] { @"/C ""FOR /L %% IN () DO ping 127.0.0.1 -n 2""" },
                };

                // START THE LONG RUNNING PROCESS
                var io          = new StringProcessIO();
                var process     = Container1.Run(pSpec, io);
                var realProcess = Process.GetProcessById(process.Id);

                Process containerHost = FindProcessByUserAndName(userid, "IronFrame.Host");

                ProcessInfoHelper.SuspendProcess(containerHost.Id);

                Container1.Stop(true);

                Assert.True(realProcess.HasExited);
            }