Beispiel #1
0
        public AsmAdjancyGraph RunIsolatedGetDpxAdjGraph(int maxWaitInSeconds = 60)
        {
            MyProcess = StartRemoteProcess(_si);
            var buffer = MyProcess.StandardOutput.ReadToEnd();

            MyProcess.WaitForExit(maxWaitInSeconds * 1000);
            if (string.IsNullOrWhiteSpace(buffer))
            {
                throw new ItsDeadJim($"The remote process {MyProcess.ProcessName} did not " +
                                     "return anything on the StandardOutput");
            }

            //HACK - the std out will have all the banner stuff printed by the R Console w\ JSON at bottom
            buffer = buffer.Substring(buffer.IndexOf('{'));

            return(JsonConvert.DeserializeObject <AsmAdjancyGraph>(buffer, JsonSerializerSettings));
        }
    public void InitializeProcess(object sender, EventArgs args)
    {
        var processStartInfo = new ProcessStartInfo
        {
            UseShellExecute        = false,
            ErrorDialog            = false,
            RedirectStandardError  = true,
            RedirectStandardInput  = true,
            RedirectStandardOutput = true
        }
        var myProcess = new Process(processStartInfo);

        Task.Run(() =>
        {
            MyProcess.Start();
            MyProcess.WaitForExit();
        });
        _streamWriter = MyProcess.StandardInput;
        _streamReader = MyProcess.StandardOutput;
    }
Beispiel #3
0
        public static int __gnat_portable_spawn(Byte[] filename, mgnat.adalib.standard.ada_string[] Args, int fd, bool stderr_to_out)
        {
            MyProcess process = new MyProcess();

#if !COMPACT
            System.IO.TextWriter stream = getWriter(fd);
            if (stream != null)
            {
                process.RedirectOutput(stream, stderr_to_out);
            }
#endif
            int ret = process.Spawn(filename, Args, false);
            if (ret != -1)
            {
                int ExitCode = -1;
                process.WaitForExit();
                ExitCode = process.ExitCode;
                process.Close();
                return(ExitCode);
            }
            process.Close();
            return(ret);
        }