Skip to content

On Windows, the 'dot' (or other progs) command fails #4

Closed
@ghost

Description

This is due to a limitation where when run via backquote or execute strings a command should have its complete name with extension. so running dot -Tpng will fail on windows. Instead dot.exe -Tpng will work.

Here is a patched find_executable() method that should work on *NIX and Windows (grab it here also: http://gist.github.com/252527 )

def find_executable(bin = @prog, *paths) #:nodoc:
  paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
  paths.each do |path|
    file = File.join(path,bin)
    if File.executable?(file) then
      return file
    elsif RUBY_PLATFORM =~ /mswin|mingw/
      found_ext = (ENV['PATHEXT'] || '.exe;.bat;.com').split(";").find {|ext| File.executable?(file + ext) }
      return file + found_ext if found_ext
    end
  end
  return nil
end

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions