java进程停止整个进程树 [英] java Process stop entire process tree

查看:33
本文介绍了java进程停止整个进程树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Java 运行时来运行命令,包括某些 CVS 命令.
我使用:

I am using Java Runtime to run commands, including certain CVS commands.
I use:

process = runtime.exec ("cmd /C cvs...");

在 Java 中运行进程的格式
我需要有停止它的选项.为此,我使用 Java Process destroy 方法

format for running the Process in Java
I need to have the option of stopping it. For this I use the Java Process destroy method

process.destroy();


然而,只有 cmd 被停止 而不是 cvs 进程.它继续作为一个单独的进程运行,而没有 cmd 进程作为父进程.
互联网上有很多关于这个的参考,但我没有找到任何令人满意的解决方案.谢谢


However only the cmd is stopped not the cvs process. It continues to run as a separate process without the cmd process as the parent.
There are many references to this on the internet, but I haven't found any satisfactory solution. Thanks

推荐答案

这是 windows cmd shell 的问题.你为什么使用它?你不能用 exec("cvs ...") 代替吗?

This is a problem with the windows cmd shell. Why do you use it? Can't you do exec("cvs ...") instead?

这篇关于java进程停止整个进程树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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