PowerShell/test/tools/CreateChildProcess/CreateChildProcess.cs
Steve Lee 44eb20dc8f Fixes #2534 by replacing expensive WMI query with Win32 API calls (#2535)
* Fixes #2534 by replacing expensive WMI query with Win32 API calls

* fix break on unix build

* added tests for #2535

* although test passed, fixing exception that shows up

* fixed Describe text

* addressing code review feedback

* addressing review feedback to comment on why sleep is needed
added check that test processes are created before we try to kill them

* fixed test to timeout and pending fix for #2561
2016-10-31 09:41:13 -07:00

25 lines
689 B
C#

using System;
using System.Diagnostics;
using System.Threading;
namespace CreateChildProcess
{
class Program
{
static void Main(string[] args)
{
if (args.Length > 0)
{
uint num = UInt32.Parse(args[0]);
for (uint i = 0; i < num; i++)
{
Process child = new Process();
child.StartInfo.FileName = Process.GetCurrentProcess().MainModule.FileName;
child.Start();
}
}
// sleep is needed so the process doesn't exit before the test case kill it
Thread.Sleep(100000);
}
}
}