Node.js js yaml在尝试解析多行字符串时冻结
尝试在node.js应用程序中使用时遇到问题 我的代码(用coffeescript编写,但我相信普通javascript用户可以阅读)如下所示:Node.js js yaml在尝试解析多行字符串时冻结,node.js,coffeescript,yaml,Node.js,Coffeescript,Yaml,尝试在node.js应用程序中使用时遇到问题 我的代码(用coffeescript编写,但我相信普通javascript用户可以阅读)如下所示: loadConfig: (path, callback = false) => fs.readFile path, 'utf8', (err, data) => console.log data throw err if err @config = yaml.eval data #freezes here as
loadConfig: (path, callback = false) =>
fs.readFile path, 'utf8', (err, data) =>
console.log data
throw err if err
@config = yaml.eval data #freezes here as mentioned below
console.log @config
foo: bar
foo:
bar: baz
尝试解析yaml配置文件时,如下所示:
loadConfig: (path, callback = false) =>
fs.readFile path, 'utf8', (err, data) =>
console.log data
throw err if err
@config = yaml.eval data #freezes here as mentioned below
console.log @config
foo: bar
foo:
bar: baz
一切如期进行。但当我把它改成这样时:
loadConfig: (path, callback = false) =>
fs.readFile path, 'utf8', (err, data) =>
console.log data
throw err if err
@config = yaml.eval data #freezes here as mentioned below
console.log @config
foo: bar
foo:
bar: baz
甚至:
# bla bla
foo: bar
我的函数冻结,没有任何错误。未到达第二个控制台.log
。在冻结了一段时间后,应用程序自杀了
我试着改变行尾格式,但没有用。是否有人知道问题的原因或如何调试/排除故障