3

关于 Java 调用命令行的问题

 2 years ago
source link: https://www.v2ex.com/t/810548
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

关于 Java 调用命令行的问题

  xjngbla · 5 小时 4 分钟前 · 465 次点击

Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", "node toPdf.js > log.log 2>&1 &"}, null, new File(PUPPETEER_PATH)).waitFor(30000, MILLISECONDS);
我尝试在 java 中调用 node 命令,需要等待命令执行结束,Process.waitFor()在 windows 上没有问题,部署到 linux 上就不起作用了


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK