到 Spidermonkey 的管道无法正常工作
我已经安装了最新版本的 Spidermonkey (JavaScript-C 1.8.5+ 2011-04-16),并注意到一个奇怪的怪癖,您可能知道答案。
在过去,如果我这样做:
echo -n "print('hi');"
结果将返回为:
js> hi
但是,现在当我运行相同的命令时,我得到的返回输出是:
js> print('hi');
hi
js>
正如您所看到的,有 3 行输出,而不仅仅是 1 行
。通常不会成为问题,但我正在使用一个特定的 CMS,它不处理此异常,因此只会出错。
有解决方法吗?我应该只安装旧版本吗?
PS 我知道 Spidermonkey 可以选择“e”(即 js -e“print('hi')”)来运行内联代码,但我使用的 CMS 再次无法以这种方式工作:\
I've installed the latest version of Spidermonkey (JavaScript-C 1.8.5+ 2011-04-16) and have noticed a strange quirk that you might know the answer to.
In the past, if I did:
echo -n "print('hi');"
The result would come back as:
js> hi
However, now when I run that very same command, the return output I get is:
js> print('hi');
hi
js>
As you can see there are 3 lines of output, rather than just 1.
This normally wouldn't be an issue, but I'm working with a particular CMS which isn't handling this exception and so just errors out.
Is there a workaround? Should I just install an older version?
P.S. I understand Spidermonkey has the option of "e" (i.e. js -e "print('hi')") to run inline code, but once again the CMS I'm using doesn't work that way :\
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来他们改变了蜘蛛猴在最新版本中的工作方式。要在 Ubuntu 10+ 中解决此问题,请按照以下说明操作:
现在,如果您运行:
它将打印:
Looks like they have changed the way spidermonkey works in the newest versions. To overcome this issue in Ubuntu 10+ follow these instructions:
Now if you run:
It will print:
Anton Babushkin 的答案+1,但最新的 SpiderMonkey 命令行选项解析器实际上在这里有一个微妙的区别:
我仅在几个月前重写了选项解析器,因此这必须是最新版本。
+1 for Anton Babushkin's answer, but the newest SpiderMonkey command line option parser actually a subtle distinction here:
I rewrote the option parser only a few months ago so this would have to be with an up to date version.