2

I have a script that calls a JAR file:

exec("$java_path/java -jar testjar.jar --username user --password pswd");

or

system("$java_path/java -jar testjar.jar --username user -password pswd");

I need to return the error code from the JAR file. Exec does this on Linux, but not on Windows. This seems to be a bug in Perl... I found it in Stack Overflow question Return code using exec is not coming back.

I started using exec, but after getting the answer from that Stack Overflow question I started using the workaround posted by ikegami. However, now my issue is that when using system the process is in the process table with the arguments showing (the main issue being the password).

I am looking for a solution where I can both get the return code and hide the password from the process table.

4

1 回答 1

1

进程只能改变它们自己的论点出现的方式——其他进程的论点是不受限制的。您将需要以某种方式将密码传递给您的 Java 应用程序,而不是作为命令行参数。

于 2013-05-23T03:38:46.833 回答