【问题标题】:Launch perl script under Windows from cygwin along with all child processes从 cygwin 在 Windows 下启动 perl 脚本以及所有子进程
【发布时间】:2013-09-26 12:35:01
【问题描述】:

我需要从 cygwin 调用 perl 脚本,但该脚本应该使用 Windows perl 而不是 cygwin perl。

# From Cygwin:
# This is correctly running under windows perl
cmd /c foo.pl

# foo's heirarchy
foo.pl
|--------> bar_1.pl
|--------> bar_2.pl
|--------> foobar/foobar.pl

如您所见,foo.pl 在内部调用了许多 perl 脚本。我希望所有这些都在 Windows perl 下运行。正在发生的事情是 foo.pl 在 Windows 下运行,但它的所有子项仍然在 cygwin perl 下运行。不幸的是,我没有修改 foo.pl 的奢侈

那么,如何确保所有子 perl 脚本都在 Windows perl 下运行?我知道这是一个

【问题讨论】:

    标签: windows perl cygwin


    【解决方案1】:

    回答我自己的问题。我想我是通过尝试让所有进程在 Windows 下运行而采取的艰难路线。我遇到了这个帖子How can I modify my cygwin environment to use Strawberry Perl instead of the packaged Perl distribution?,通过在我的脚本中本地更改 PATH,问题得到了解决。现在一切都很好:)

    【讨论】:

    • 像这样更改 cygwin 安装可能很危险。其他 cygwin 工具可能期望在 /usr/bin/perl 中有一个真正的 cygwin perl,但会因 Strawberry Perl 而失败。如果您将$ENV{PATH} 更改为在/usr/bin 之前使用草莓bin 路径,或者在调用foo.pl 中的脚本时使用$^X 而不是perl,也许会更好。
    • 谢谢奴隶。我最终做了你提到的事情。我将编辑我的答案。
    猜你喜欢
    • 2013-06-18
    • 2015-05-16
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 2013-05-07
    • 2013-09-18
    • 2020-09-04
    • 1970-01-01
    相关资源
    最近更新 更多