我可以停止重定向输出吗? [英] Can I stop redirecting outputs?

查看:98
本文介绍了我可以停止重定向输出吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如果发生崩溃或什么不是,我希望能够从进程I释放输出并监视strOut和stdErr。我感觉解耦了听众然后设置

_process.StartInfo.RedirectStandardError = false;是不行的。





是否可以停止重定向过程输出或是否必须将它们重定向到别处?



提前谢谢^ _ ^

Hi,

In case of crash or what-not I want to be able to release the outputs from a process I and monitoring strOut and stdErr on. I get the feeling that uncoupling the listeners and then setting
_process.StartInfo.RedirectStandardError = false; isn't going to work.


Is it possible to stop redirecting the process outputs or do I have to redirect them elsewhere?

Thanks in advance ^_^

推荐答案

这完全取决于你如何启动这个过程。您是直接启动.EXE还是将.EXE作为命令行参数提供,而是通过启动CMD.EXE启动它?



但是,一次进程崩溃,进程已经死亡,标准流也是如此。没有什么可以重定向,所以问题毫无意义。
This depends entirely on how you launched the process. Did you launch the .EXE directly or did you supply the .EXE as a command line argument and you launched it by launched CMD.EXE instead??

But, once the process crashes, the process is dead and so are the standard streams. There's nothing left to redirect, so the question is pointless.


DOH> _<< br mode =hold/>

异步开始收听到频道:

DOH >_<<br mode="hold" />
Async start listening to channels:
_windowsProcess.BeginOutputReadLine();
_windowsProcess.BeginErrorReadLine();





并停止:



and to stop:

_windowsProcess.CancelOutputRead();
_windowsProcess.CancelErrorRead();





我正在寻找停止或结束。这花了我一段时间才发现(猜测我仍然不擅长谷歌搜索)



实际上有更深层次的问题,但我已经有了一个单独的线程(< a href =http://www.codeproject.com/Questions/605115/stdoutplusandplusstderrplusListenerplusissuesplus> stdout和stderr监听器问题(导致冻结进程?) [ ^ ])



希望其他人会发现这个有用



谢谢所有^ _ ^



I was looking for stop or end. This took me a while to find (guess I'm still no good at googling)

There are actually deeper issues but I already have a separate thread for that ( stdout and stderr Listener issues (causing frozen processes?)[^] )

Hopefully someone else will find this useful

Thanks all ^_^


这篇关于我可以停止重定向输出吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆