Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Cannot run CoffeeScript in shebang mode #11744

Closed
sodabrew opened this issue Nov 11, 2013 · 3 comments
Closed

Cannot run CoffeeScript in shebang mode #11744

sodabrew opened this issue Nov 11, 2013 · 3 comments

Comments

@sodabrew
Copy link
Contributor

I'd like to write a command-line tool in CoffeeScript. This does not work:

#!/usr/bin/env phantomjs

# Coffee style comment
console.log "Hello there are no parentheses here because it's coffeescript"

Results in SyntaxError: Parse error

Reason appear to be that the method jsFromScriptFile does not have a way to clue phantomjs in that a file that starts with #! (shebang) might be written in coffeescript.

I could rename my script to scriptname.coffee, and then execute the script directly and it works, but defeats the purpose of having a useful executable script name.

https://github.com/ariya/phantomjs/blob/1.9/src/utils.cpp#L165-189

@ariya
Copy link
Owner

ariya commented Dec 13, 2013

While the support is there by the above two commits, there's still a bug. Launching like this:

phantomjs --script-language somescript.js

causes PhantomJS to open its REPL. I think it should still reject the empty language value like that.

sodabrew added a commit to sodabrew/phantomjs that referenced this issue Dec 13, 2013
sodabrew added a commit to sodabrew/phantomjs that referenced this issue Dec 13, 2013
sodabrew added a commit to sodabrew/phantomjs that referenced this issue Dec 13, 2013
sodabrew added a commit to sodabrew/phantomjs that referenced this issue Dec 13, 2013
@sodabrew
Copy link
Contributor Author

Thanks! Looking forward to the next release :)

@sodabrew
Copy link
Contributor Author

sodabrew commented May 2, 2014

@ariya I noticed that this hasn't landed in a PhantomJS 1.9.x release yet - may I request a cherry-pick of this PR and related commits -- see https://github.com/ariya/phantomjs/commits?author=sodabrew -- to the 1.9 branch?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants