Beispiel #1
0
        public static int Start(BinaryInfo info, string extra_args, MBFile stdin,
                                MBFile stdout, MBFile stderr, IBuildContext ctxt)
        {
            StreamReader stdin_stream  = null;
            StreamWriter stdout_stream = null;
            StreamWriter stderr_stream = null;

            if (stdin != null)
            {
                stdin_stream = new StreamReader(stdin.OpenRead(ctxt));
                ctxt.Logger.Log("launcher.stdin_from", stdin.GetPath(ctxt));
            }

            if (stdout != null)
            {
                stdout_stream = new StreamWriter(stdout.OpenWrite(ctxt));
                ctxt.Logger.Log("launcher.stdout_to", stdout.GetPath(ctxt));
            }

            if (stderr != null)
            {
                stderr_stream = new StreamWriter(stderr.OpenWrite(ctxt));
                ctxt.Logger.Log("launcher.stderr_to", stderr.GetPath(ctxt));
            }

            return(Start(info, extra_args, stdin_stream, stdout_stream,
                         stderr_stream, ctxt));
        }
Beispiel #2
0
        public static int Start(BinaryInfo info, string extra_args, MBFile stdin,
                                MBFile stdout, out string stderr, IBuildContext ctxt)
        {
            MemoryStream ms            = new MemoryStream(32);
            StreamReader stdin_stream  = null;
            StreamWriter stdout_stream = null;
            StreamWriter stderr_stream = null;
            int          exit_code;

            if (stdin != null)
            {
                stdin_stream = new StreamReader(stdin.OpenRead(ctxt));
                ctxt.Logger.Log("launcher.stdin_from", stdin.GetPath(ctxt));
            }

            if (stdout != null)
            {
                stdout_stream = new StreamWriter(stdout.OpenWrite(ctxt));
                ctxt.Logger.Log("launcher.stdout_to", stdout.GetPath(ctxt));
            }

            stderr_stream = new StreamWriter(ms);

            exit_code = Start(info, extra_args, stdin_stream, stdout_stream,
                              stderr_stream, ctxt);

            byte[] buf = ms.ToArray();
            stderr = System.Text.Encoding.Default.GetString(buf).Trim();

            return(exit_code);
        }
Beispiel #3
0
 public static void DrainStream(MBFile file, IBuildContext ctxt, IMiniStreamSink sink)
 {
     DrainStream(file.OpenRead(ctxt), sink);
 }