Perl system()调用失败,返回码65280 [英] Perl system() call failed with return code 65280
问题描述
在下面的代码中,我可以运行$ retCode = ClearCase($ cmd);没有错误,但是运行此命令时返回65280:$ retCode = ClearCase($ logcmd);我在XP和Windows 2003服务器上尝试了相同的结果,都使用ActiveState Perl v5.14.2。
I the code below, I can run $retCode = ClearCase($cmd); with no error, but return 65280 when run this: $retCode = ClearCase($logcmd); I tried on XP and Windows 2003 server, same result, all with ActiveState Perl v5.14.2.
此代码在2年前在其他地方工作。
This code was working 2 years ago somewhere else.
感谢
Jirong
Thanks Jirong
$g_HPPC_DEV_DRIVE = "M";
$g_HPPC_DEV_VIEW = "bldforge_AOMS_DEV";
$g_logfile = "logfile.txt";
$cmd = "startview $g_HPPC_DEV_VIEW";
$logcmd = $cmd . " >> $g_logfile 2>>&1";
$targetDir = $g_HPPC_DEV_DRIVE . ":\\" . $g_HPPC_DEV_VIEW;
print "\$targetDir = $targetDir\n";
print "Starting view .......\n";
#$retCode = system("cleartool startview bldforge_AOMS_DEV >> logfile.txt");
#$retCode = `cleartool startview bldforge_AOMS_DEV`;
$retCode = ClearCase($logcmd);
#$retCode = ClearCase($cmd);
sub ClearCase
{
my $retCode = 0;
my $args = $_[0];
my $cmd = "cleartool " . $args;
$retCode = Execute($cmd);
return $retCode;
}
sub Execute
{
my $retCode = 0;
my $cmd = $_[0];
if ($g_HPPC_BUILD_SIMULATION ne "Y")
{
print("Execute() Running...: $cmd\n");
$retCode = system($cmd);
#$retOut = `$cmd`;
#$retCode = $?;
#print("Command execute output: $retOut\n");
}
else
{
print("Execute() *** SIMULATION: $cmd\n");
}
print("Execute() retCode = $retCode, $cmd\n");
return $retCode;
}
推荐答案
使用cleartool时最好确保使用 ccperl
(现在称为 ratlperl
),它与ClearCase一起打包,而不是非常最新的Active Perl (实际上是5.14.2 )。
When using cleartool, it is best to ensure using ccperl
(now called ratlperl
), the perl packaged with ClearCase, instead of the very latest Active Perl (which actually is the 5.14.2).
因此,不是默认启动您的perl脚本,而是选择第一个 perl.exe
您的%PATH%
,请尝试使用 ClearCase随附的perl :
So instead of launching your perl script by default, picking up the first perl.exe
available in your %PATH%
, try calling it with one of the perl included with ClearCase:
-
ratlperl
:在C:\Program Files\Rational\Common
中。 - 或旧版
ccperl
:在C中:\Program Files\Rational\ \ClearCase\bin
。
ratlperl
: inC:\Program Files\Rational\Common
.- or the legacy
ccperl
: inC:\Program Files\Rational\ClearCase\bin
.
然后查看错误是否仍然存在。
And see if the error persists.
根本原因是 PATH
问题:几个 perl
可用:
The root cause was a PATH
issue: several perl
were available:
- Rational ClearCase中的
- Active Perl中的一个
请确保 PATH
仅引用一个 perl
(一个附带在ClearCase中的脚本),脚本可以成功启动。
By making sure the PATH
only reference one perl
(the one shipped with ClearCase), the script could be launched successfully.
这篇关于Perl system()调用失败,返回码65280的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!