{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/716","labels_url":"https://api.github.com/repos/manastech/crystal/issues/716/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/716/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/716/events","html_url":"https://github.com/manastech/crystal/issues/716","id":83033059,"number":716,"title":"Issue with File on some cases","user":{"login":"bararchy","id":1631073,"avatar_url":"https://avatars.githubusercontent.com/u/1631073?v=3","gravatar_id":"","url":"https://api.github.com/users/bararchy","html_url":"https://github.com/bararchy","followers_url":"https://api.github.com/users/bararchy/followers","following_url":"https://api.github.com/users/bararchy/following{/other_user}","gists_url":"https://api.github.com/users/bararchy/gists{/gist_id}","starred_url":"https://api.github.com/users/bararchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bararchy/subscriptions","organizations_url":"https://api.github.com/users/bararchy/orgs","repos_url":"https://api.github.com/users/bararchy/repos","events_url":"https://api.github.com/users/bararchy/events{/privacy}","received_events_url":"https://api.github.com/users/bararchy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-31T08:00:54Z","updated_at":"2015-05-31T14:53:58Z","closed_at":"2015-05-31T10:26:08Z","body":"On carc.in with Crystal 0.7.2 sending to File# path as a string or as a local variable holding string is working.\r\n1) string http://carc.in/#/r/11t\r\n2) variable http://carc.in/#/r/11u\r\n\r\nOn my latest git version this is the error I get:\r\n```\r\nError in ./src/rsaccess-daemon.cr:170: instantiating 'fork()'\r\n\r\nfork do \r\n^~~~\r\n\r\nin /home/unshadow/Desktop/git-projects/crystal/src/process/process.cr:79: instantiating 'Process:Class#fork()'\r\n\r\n  Process.fork { yield }\r\n          ^~~~\r\n\r\nin /home/unshadow/Desktop/git-projects/crystal/src/process/process.cr:79: instantiating 'Process:Class#fork()'\r\n\r\n  Process.fork { yield }\r\n          ^~~~\r\n\r\nin ./src/rsaccess-daemon.cr:170: instantiating 'fork()'\r\n\r\nfork do \r\n^~~~\r\n\r\nin ./src/rsaccess-daemon.cr:171: instantiating 'Rsaccess::Daemon::Execute:Class#run()'\r\n\r\n  Rsaccess::Daemon::Execute.run\r\n                            ^~~\r\n\r\nin ./src/rsaccess-daemon.cr:30: instantiating 'File:Class#exists?((String | Int32 | Int64 | Float64 | Time | Bool | Hash(String, TOML::Type) | Array(TOML::Type)))'\r\n\r\n          File.delete(pid_path) if File.exists?(pid_path)\r\n                                        ^~~~~~~\r\n\r\nin /home/unshadow/Desktop/git-projects/crystal/src/file.cr:90: argument 'filename' of 'LibC#access' must be Pointer(UInt8), not (String | Int32 | Int64 | Float64 | Time | Bool | Hash(String, TOML::Type) | Array(TOML::Type))\r\n\r\n    LibC.access(filename, LibC::F_OK) == 0\r\n                ^~~~~~~~\r\n\r\n\r\n```\r\n\r\nMy code is this:\r\n\r\n```crystal\r\nif log_path.is_a?(String)\r\n  io = File.open(log_path, \"w\")\r\n  if io.is_a?(IO)\r\n    log = Logger.new(io)\r\n  else\r\n    STDERR.puts \"Cannot write or set IO object for #{log_path}\"\r\n    exit 1\r\n  end\r\nelse\r\n  STDERR.puts \"log_path isn't properly configured in the daemon.conf\"\r\n  exit 1\r\nend\r\n\r\nSignal.trap(Signal::INT) do\r\n  if pid_path && pid_path.is_a?(String)\r\n    File.delete(pid_path) if File.exists?(pid_path)\r\n  end\r\n  if log\r\n    log.fatal(\"Got SIGINT - Closing Daemon\")\r\n    exit 0\r\n  else\r\n    STDERR.puts \"Got SIGINT - Closing Daemon\"\r\n    exit 0\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/107200646","html_url":"https://github.com/manastech/crystal/issues/716#issuecomment-107200646","issue_url":"https://api.github.com/repos/manastech/crystal/issues/716","id":107200646,"user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"created_at":"2015-05-31T14:53:58Z","updated_at":"2015-05-31T14:53:58Z","body":"The problem is that `pid_path` is being closured by the Signal handler, so the compiler does what it says [here](http://crystal-lang.org/docs/syntax_and_semantics/closures.html#type-of-closured-variables). This is what @jhass says.\r\n"}}