public CommandResult ExecuteNodeCommand(string args)
{
// /c directive tells cmd to close when it is done
var procStartInfo = new ProcessStartInfo()
{
FileName = _nodeExePath,
Arguments = args,
RedirectStandardError = true,
RedirectStandardOutput = true,
RedirectStandardInput = true,
UseShellExecute = false,
CreateNoWindow = true
};
if (_workspace != null && _workspace.Exists)
{
procStartInfo.WorkingDirectory = _workspace.FullName;
}
// Now we create a process, assign its ProcessStartInfo and start it
var proc = new Process { StartInfo = procStartInfo };
proc.Start();
return new CommandResult(WaitForExitAsync(proc), proc.StandardOutput, proc.StandardError, proc.StandardInput);
}