// This file is part of the OWASP O2 Platform (http://www.owasp.org/index.php/OWASP_O2_Platform) and is released under the Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using O2.Kernel.CodeUtils;
using O2.DotNetWrappers.ExtensionMethods;
namespace O2.DotNetWrappers.Windows
{
public class Processes
{
private const int iMaxProcessExecutionTimeOut = 120000;
// this will kill all current O2 processes (good when doing updates of the latests O2 exec)
public static void killO2s()
{
int iCurrentProcess = Process.GetCurrentProcess().Id;
foreach (Process pProcess in Process.GetProcesses())
public static Process startProcess(String sProcessToStart, String sArguments, bool CreateNoWindow)
{
try
{
DI.log.debug("Starting process {0} with arguments {1}", sProcessToStart, sArguments);
var pProcess = new Process {StartInfo = {Arguments = sArguments, FileName = sProcessToStart,WorkingDirectory = Path.GetDirectoryName(sProcessToStart)}};