jbt / docker

Documentation generator
http://jbt.github.com/docker
MIT License
234 stars 56 forks source link

shebangRegex in version next more open as the os #100

Closed alinex closed 8 years ago

alinex commented 8 years ago

in docker.js line 604 it is defined as

  var shebangRegex = /^\n*#!\s*(?:\/usr\/bin\/env)?\s*(?:[^\n]*\/)*([^\/\n]+)(?:\n|$)/;

The shebang must be the first line because it is interpreted by the kernel, which looks at the two bytes at the start of an executable file. If these are #! the rest of the line is interpreted as the executable to run and with the script file available to that program.

Maybe this is the intention to detect also then the syntax is not completely to the standard because you want to document not to lint the code.

See this only as a hint. I don't know if this is good or bad.

jbt commented 8 years ago

I honestly don't know why that \n* is in there at all - as you say it has to be the first two bytes of the file so it definitely makes sense to take that out