ClojureScript

Calling count on args passed to a nodejs main function returns an incorrect number

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

This is an interesting one.

(defn -main [& args]
  (prn (count args)))

(set! *main-cli-fn* -main)

No matter how many arguments you pass to this application, count always says there are two more. The arguments appear to be fine upon inspection, it's just the count that is incorrect. I investigated a bit and noticed that node passes two extra arguments that are always dropped before being passed to -main.

(prn (count (drop 2 (seq (.argv nodejs/process)))))

I tried the above and was surprised to find out that the count was correct.

Activity

Hide
David Nolen added a comment -

Unless we hear whether is still a problem - marking low priority.

Show
David Nolen added a comment - Unless we hear whether is still a problem - marking low priority.
Hide
Anthony Grimes added a comment -

This appears to have been fixed.

Show
Anthony Grimes added a comment - This appears to have been fixed.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: