public static ProcessManager.ProcessState MonitorProcessOutput(this ReactiveProcess process) {
            Contract.Requires<ArgumentNullException>(process != null);

            var state = new ProcessManager.ProcessState();

            if (!process.StartInfo.RedirectStandardOutput)
                throw new InvalidOperationException("Not redirected output");
            if (!process.StartInfo.RedirectStandardError)
                throw new InvalidOperationException("Not redirected error");

            // we terminate the observables so we dont have to dispose these subscriptions
            process.StandardOutputObservable.Subscribe(_ => state.UpdateStamp());
            process.StandardErrorObservable.Subscribe(_ => state.UpdateStamp());
            return state;
        }
        public static ProcessManager.ProcessState MonitorProcessOutput(this Process process) {
            Contract.Requires<ArgumentNullException>(process != null);

            var state = new ProcessManager.ProcessState();

            if (!process.StartInfo.RedirectStandardOutput)
                throw new InvalidOperationException("Not redirected output");
            if (!process.StartInfo.RedirectStandardError)
                throw new InvalidOperationException("Not redirected error");

            process.OutputDataReceived += (sender, args) => state.UpdateStamp();
            process.ErrorDataReceived += (sender, args) => state.UpdateStamp();

            return state;
        }
Beispiel #3
0
        public static ProcessManager.ProcessState MonitorProcessOutput(this ReactiveProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var state = new ProcessManager.ProcessState();

            if (!process.StartInfo.RedirectStandardOutput)
            {
                throw new InvalidOperationException("Not redirected output");
            }
            if (!process.StartInfo.RedirectStandardError)
            {
                throw new InvalidOperationException("Not redirected error");
            }

            // we terminate the observables so we dont have to dispose these subscriptions
            process.StandardOutputObservable.Subscribe(_ => state.UpdateStamp());
            process.StandardErrorObservable.Subscribe(_ => state.UpdateStamp());
            return(state);
        }
Beispiel #4
0
        public static ProcessManager.ProcessState MonitorProcessOutput(this Process process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var state = new ProcessManager.ProcessState();

            if (!process.StartInfo.RedirectStandardOutput)
            {
                throw new InvalidOperationException("Not redirected output");
            }
            if (!process.StartInfo.RedirectStandardError)
            {
                throw new InvalidOperationException("Not redirected error");
            }

            process.OutputDataReceived += (sender, args) => state.UpdateStamp();
            process.ErrorDataReceived  += (sender, args) => state.UpdateStamp();

            return(state);
        }