开发者

Ruby unable to find external programs in PATH environmental variable

开发者 https://www.devze.com 2023-04-11 09:26 出处:网络
Can someone explain what\'s changed in Ruby when looking for programs in PATH? I know this used to work.

Can someone explain what's changed in Ruby when looking for programs in PATH? I know this used to work.

From Windows Command Line (exiftool is in C:\Windows\system32):

C:\>exiftool
Usage: exiftool [ -Alib.par ] [ -Idir ] [ -Mmodule ] [ src.par ] [ program.pl ]
   exiftool [ -B|-b ] [-Ooutfile] src.par

From irb:

`exiftool`
Errno::ENOENT: No such file or directory - exif开发者_如何转开发tool
    from (irb):1:in ``'
    from (irb):1
    from C:/Ruby192/bin/irb:12:in `<main>'


I could be off here, but don't you need to wrap that in a system call - i.e. execute it as if it's running on the command line? In IRB I can type any command I want that is a system command, and I get the same results you're seeing unless I wrap it as such:

system("exiftool")

For example, to display the list of files in the current directory in IRB, dir fails, but system("dir") works.

0

精彩评论

暂无评论...
验证码 换一张
取 消