小编use*_*329的帖子

Perl system()调用失败,返回码为65280

我在下面的代码,我可以运行$ retCode = ClearCase($ cmd); 没有错误,但运行时返回65280:$ retCode = ClearCase($ logcmd); 我尝试使用XP和Windows 2003服务器,结果相同,都使用ActiveState Perl v5.14.2.

这段代码在2年前的其他地方工作.

谢谢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 = …
Run Code Online (Sandbox Code Playgroud)

windows perl clearcase cleartool

3
推荐指数
1
解决办法
1万
查看次数

如何在 Groovy 中执行 shell 命令并获取返回码 $?

我无法通过在 Groovy 中执行 shell 脚本获得返回码(不是输出或错误)。

对于我尝试过的所有操作,它要么要求我转义,要么只打印 $? 而不是给我 1 或 0。

groovy: 75: 美元符号后的非法字符串体字符;解决方案:要么转义文字美元符号“\$5”,要么将值表达式“${5}”@第 75 行,第 24 列括起来。

以下是我尝试过的解决方案,都不起作用。

println "../src/check_job_log.s ${it}.log".execute().text
println "Check log ${it}.log completed"

//assert ("echo \$?".execute().text == "1")
//output = """echo $?""".execute().text
println(['echo', '$?'].execute().text)

// below is code for  @that other guy
//def process = "echo hello world".execute()
def process = "../src/check_job_log.s ${it}.log".execute()
print "Output: " + process.text
print "Exit code: " + process.exitValue()

Output: Exit code: 01
Run Code Online (Sandbox Code Playgroud)

shell groovy return-value

2
推荐指数
1
解决办法
7131
查看次数

标签 统计

clearcase ×1

cleartool ×1

groovy ×1

perl ×1

return-value ×1

shell ×1

windows ×1