test_chdir.pl:
my $view_dir = "M:\\ccadm01_UARK_DEV";
print ("\$view_dir = $view_dir\n");
chdir($view_dir);
$cmd = `cd`;
print ("\$cmd = $cmd");
$cmd = "cleartool describe -fmt \"%[versions]Cp\" activity:USR0200004985\@\\Unix_PVOB";
print ("\$cmd = $cmd\n");
$output = qx{$cmd};
print ("\$output = $output\n");
如果我在同一台服务器上从命令行运行它,它会产生正确的结果:
D:\CCSTG\Unix>cqperl test_chdir.pl
$view_dir = M:\ccadm01_UARK_DEV
$cmd = M:\ccadm01_UARK_DEV
$cmd = cleartool describe -fmt "%[versions]Cp" activity:USR0200004985@\Unix_PVOB
$output = M:\ccadm01_UARK_DEV\Unix_AVOB\UARK_src\CNTL\NOPROC\denise6.ctl@@\main\UARK_PRD\UARK_DEV\13
D:\CCSTG\Unix>perl test_chdir.pl
$view_dir = M:\ccadm01_UARK_DEV
$cmd = M:\ccadm01_UARK_DEV
$cmd = cleartool describe -fmt "%[versions]Cp" activity:USR0200004985@\Unix_PVOB
$output = M:\ccadm01_UARK_DEV\Unix_AVOB\UARK_src\CNTL\NOPROC\denise6.ctl@@\main\UARK_PRD\UARK_DEV\13
但是,当我在CQ挂钩中运行完全相同的代码时,如下所示,它会产生空输出。我有一个按钮调用记录脚本DeployPAT,它依次调用Deploy:
sub basecmactivity_Deploy {
my($result);
my($param) = @_;
# record type name is BaseCMActivity
$session->OutputDebugString ("Start Deploy ...\n");
my $view_dir = "M:\\ccadm01_UARK_DEV";
$session->OutputDebugString ("\$view_dir = $view_dir\n");
chdir($view_dir);
$cmd = `cd`;
$session->OutputDebugString ("\$cmd = $cmd\n");
$cmd = "cleartool describe -fmt \"%[versions]Cp\" activity:USR0200004985\@\\Unix_PVOB";
$session->OutputDebugString ("\$cmd = $cmd\n");
$output = qx{$cmd};
$session->OutputDebugString ("\$output = $output\n");
$session->OutputDebugString ("End Deploy ...\n");
return $result;
}
sub basecmactivity_DeployPAT {
my($result);
my($param) = @_;
# record type name is BaseCMActivity
$session->OutputDebugString ("Start DeployPAT ...\n");
$result = $entity->FireNamedHook("Deploy","");
$session->OutputDebugString ("End DeployPAT ...\n");
return $result;
}
Output from dbwin32:
16840: Start DeployPAT ...
16840: Start Deploy ...
16840: $view_dir = M:\ccadm01_UARK_DEV
16840: $cmd =
16840: $cmd = cleartool describe -fmt "%[versions]Cp" activity:USR0200004985@\Unix_PVOB
16840: $output =
16840: End Deploy ...
16840: End DeployPAT ...
IBM支持人员在两个月后没有任何帮助,他们说“DBWIN32会在看到输出之前切断输出,我将能够看到它。”这到底意味着什么?跟踪如何帮助我?我后来的代码操纵这些输出。如果输出为空,我该如何编码继续?
我们正在从v7迁移到v8,这个问题完全阻止了我们。谁能在这里分享一些灯?谢谢Jirong