Fix changes from review of #1212.
This commit is contained in:
parent
55216a8cef
commit
4b1a1a8292
|
@ -10,13 +10,21 @@ module.exports = class HhFormat extends Beautifier
|
|||
link: "http://hhvm.com/"
|
||||
|
||||
options:
|
||||
PHP: true
|
||||
PHP: false
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@run("hh_format", [
|
||||
@tempFile("input", text)
|
||||
]).then((output) =>
|
||||
# hh_format can exit with status 0 and no output for some files which
|
||||
# it doesn't format. In that case we just return original text.
|
||||
if output.trim() then output else text
|
||||
)
|
||||
],
|
||||
{
|
||||
help: {
|
||||
link: "http://hhvm.com/"
|
||||
}
|
||||
}).then((output) ->
|
||||
# hh_format can exit with status 0 and no output for some files which
|
||||
# it doesn't format. In that case we just return original text.
|
||||
if output.trim()
|
||||
output
|
||||
else
|
||||
@Promise.resolve(new Error("hh_format returned an empty output."))
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue