source/TestCommon/source/FunctionApp.TestCommon/Azurite/AzuriteManager.cs
/// <summary>
/// If test code has been used correctly there should be no hanging Azurite process.
/// </summary>
If test code has been used correctly there should be no hanging Azurite process.
If test code has been used correctly there should be no hanging Azurite process .
private static void StopHangingAzuriteProcess()
        {
            var nodeProcesses = Process.GetProcessesByName("node");
            foreach (var nodeProcess in nodeProcesses)
            {
                var parentProcessId = GetParentProcessId(nodeProcess);
                try
                {
                    var parentProcess = Process.GetProcessById((int)parentProcessId);
                    if (!parentProcess.HasExited && parentProcess.ProcessName == "cmd")
                    {
                        KillAndDisposeProcess(nodeProcess);
                    }
                }
                catch (ArgumentException)
                {
                    KillAndDisposeProcess(nodeProcess);
                    break;
                }
            }
        }
private static void StopHangingAzuriteProcess ( ) { var nodeProcesses = Process . GetProcessesByName ( " " ) ; foreach ( var nodeProcess in nodeProcesses ) { var parentProcessId = GetParentProcessId ( nodeProcess ) ; try { var parentProcess = Process . GetProcessById ( ( int ) parentProcessId ) ; if ( ! parentProcess . HasExited && parentProcess . ProcessName == " " ) { KillAndDisposeProcess ( nodeProcess ) ; } } catch ( ArgumentException ) { KillAndDisposeProcess ( nodeProcess ) ; break ; } } }
If test code has been used correctly there should be no hanging Azurite process.
If test code has been used correctly there should be no hanging Azurite process .
// The Azurite process is called "node.exe" // Warning: We assume that Azurite is the only Nodejs process started with cmd.exe // Process.GetProcessById() throws ArgumentException when the process id has been killed // We assume that Azurite is the only Nodejs process where the parent has been killed