| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /*
- * Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System;
- namespace Crown
- {
- public class LocalExec
- {
- public Process _process;
- public LocalExec()
- {
- _process = new Process();
- _process.EnableRaisingEvents = true;
- }
- public void Close()
- {
- if (!_process.HasExited)
- {
- _process.Kill();
- _process.Close();
- }
- }
- public void Start(string name, string args, string workdir)
- {
- ProcessStartInfo startInfo = new ProcessStartInfo();
- startInfo.FileName = name;
- startInfo.Arguments = args;
- startInfo.WorkingDirectory = workdir;
- _process.StartInfo = startInfo;
- _process.Start();
- }
- }
- }
|