代码之家  ›  专栏  ›  技术社区  ›  brian d foy

如何让Perl 6在Windows上运行?

  •  7
  • brian d foy  · 技术社区  · 6 年前

    我在玩 run 在Windows上。尝试使用 dir 不起作用,但也许我遗漏了什么:

    put '-' x 70;
    my $p1 = run 'dir', :out;
    put "exit code: {$p1.exitcode}";
    put $p1.out.slurp(:close);
    
    put '-' x 70;
    my $p2 = Proc.new: :out;
    put "exit code: {$p2.exitcode}";
    $p2.spawn: 'dir';
    $p2.out.slurp(:close).say;
    

    输出只是规则和退出代码行:

    ----------------------------------------------------------------------       
    exit code: 1                                                                 
    
    ----------------------------------------------------------------------       
    exit code: 1                                                                 
    

    这个 目录 适用于 shell 但这是一种不同的做事方式。我可以这样做,但那是通过外壳 想要避免:

    my $p1 = run 'cmd.exe', '/C', 'dir', :out;
    
    2 回复  |  直到 6 年前
        1
  •  8
  •   Christoph    6 年前

    鉴于 dir 是shell命令,不是可执行文件。

    如果你击中 ——获胜 + R 打开“管路”对话框并输入 目录 ,它将因相同的原因失败(除非您碰巧有一个不相关的可执行文件 dir.exe 在你的道路上的某个地方)。

        2
  •  0
  •   brian d foy    6 年前

    那可能是 a bug related to libuv's handling of arguments dir 是内部 cmd.exe 命令我自己对Windows不太熟悉,但我认为最好提出一个问题。