简体   繁体   English

什么是Mac和Windows的“有效系统进程”。 (java的ProcessBuilder)

[英]what is a “Valid System process” for mac and windows. (java ProcessBuilder)

I am trying to work out the semantics of using Java ProcessBuilder to call operating system processes and read this line out of the javadocs for the start command : 我正在尝试弄清楚使用Java ProcessBuilder调用操作系统进程的语义,并从javadocs中读取以下行作为start命令

"This method checks that the command is a valid operating system command. Which commands are valid is system-dependent, but at the very least the command must be a non-empty list of non-null strings." “此方法检查该命令是否为有效的操作系统命令。哪些命令有效取决于系统,但至少该命令必须是非空字符串的非空列表。”

Tell me, What is considered a valid process for Mac and for Windows? 告诉我,对于Mac和Windows,什么才是有效的过程? Is it anything that can be found on the PATH variable? 是否可以在PATH变量上找到任何内容?

Is it anything that can be found on the PATH variable? 是否可以在PATH变量上找到任何内容?

Yes it is; 是的; although you can also specify the full path of the command if you like (such as "/bin/ls" ). 尽管您也可以根据需要指定命令的完整路径(例如"/bin/ls" )。 Another test if of course to check if the file in question is a regular file and has execution permissions. 当然要进行另一项测试,以检查所涉及的文件是否为常规文件并具有执行权限。

Note: this will launch a "real" process, it will not launch it via a command interpreter; 注意:这将启动“真实”进程, 不会通过命令解释器启动它; as such don't attempt to use pipes, file globs, shell builtins etc: those are interpreted by sh / cmd . 因此,请勿尝试使用管道,文件glob,shell内置程序等:这些将由sh / cmd解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM