Esempio n. 1
0
		public static int SaveToolStdout (BinaryInfo info, string extra_args, MBFile stdout, 
						  out string stderr, IBuildContext ctxt) 
		{
		    Stream sout = stdout.OpenWrite (ctxt);
		    StreamWriter wout = new StreamWriter (sout);
		    MemoryStream mserr = new MemoryStream (32);
		    StreamWriter err = new StreamWriter (mserr);

		    int result = Start (info, extra_args, null, wout, err, ctxt);

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

		    ctxt.Logger.Log ("launcher.stdout_to", stdout.GetPath (ctxt));
		    ctxt.Logger.Log ("launcher.stderr", stderr);
		    return result;
		}
Esempio n. 2
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);
		}
Esempio n. 3
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;
		}
Esempio n. 4
0
		public IOSink (MBFile file, IBuildContext ctxt) {
			if (file == null)
				throw new ArgumentNullException ();

			writer = new StreamWriter (file.OpenWrite (ctxt));
		}