大佬教程收集整理的这篇文章主要介绍了当我使用非零参数显式调用exit时,为什么我的Perl脚本返回零返回码?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
print "INFO: Calling ${scriptDirectory}/${script} ${args}" $scriptReturnCode = system("${scriptDirectory}/${script} ${args}"); if ( $scriptReturnCode <=> 0 ) { print "ERROR: The script returned $scriptReturnCode\n"; exit $scriptReturnCode; } else { print "INFO: The script returned $scriptReturnCode.\n"; exit 0; }@H_618_2@我从Java获得的输出是:
20/04/2010 14:40:01 - INFO: Calling /path/to/script/script.ksh arg1 arg2 20/04/2010 14:40:01 - Could not find installer files <= this is from the script.ksh 20/04/2010 14:40:01 - ERROR: The script returned 256 20/04/2010 14:40:01 - Command Finished. Exit Code: 0 <= this is the Java app.
system(); if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died - signal %d,%s coredump\n",($? & 127),($? & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n",$? >> 8; }@H_618_2@更新:根据ysth的优秀提醒,退出代码被截断为8(低)位,因此返回256而不是预期的1最终为0.同样,返回257最终为1.
以上是大佬教程为你收集整理的当我使用非零参数显式调用exit时,为什么我的Perl脚本返回零返回码?全部内容,希望文章能够帮你解决当我使用非零参数显式调用exit时,为什么我的Perl脚本返回零返回码?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。