Invoking runtests through TortoiseSVN client side hook script for pre-commit
使用tortoiseSVN客户端挂钩脚本进行预提交,我们试图使用Test :: Harness的runtests子运行一些单元测试用例。
在TortoiseSVN的"设置"->"挂钩脚本"->"配置挂钩脚本"(用于预提交)中,我在"要执行的命令行:"标题下提供了一个批处理文件名。
此批处理文件包含以下行
run.pl unittest.t
run.pl内容
1 2 3 4 5 6 7 8 | #!/usr/bin/perl -w use strict; use warnings; use Test::Harness; # Run a single test suite my @files = @ARGV; runtests(@files); |
因此,当我尝试提交任何代码时,此脚本将被调用并失败,并显示以下错误消息:
1 | Could not execute (D:\\Perl589\\bin\\perl.exe -w D:\\t\\unittest.t): open3: Can't call method"close" on an undefined value at D:/Perl589/lib/IPC/Open3.pm line 368. |
任何想法我们如何解决此问题。
您的Windows计算机是否知道如何处理以
一旦您在Perl和
否则,您只需要将Perl解释器的名称放在批处理文件的挂钩脚本中:
1 | C:\\Perl\\bin\\perl run.pl unittest.t |
另一种可能性是使用Perl安装随附的pl2bat脚本,该脚本会将Perl脚本转换为批处理文件。