4
的文档,Vim的system
函数表示,这对第二个参数:如何使用系统的第二个参数(输入)()函数
当{输入}给出,这个字符串写入一个文件,作为stdin传递给命令。
我从明白那是什么,如果你的system
调用是这样的:
call system('node something.js --file', 'here is some text')
执行看起来像这样的命令:
node something.js --file some/temp/file
和some/temp/file
将有文字here is some text
作为其内容。为了测试这个,我跑了Vim命令(第二行是结果):
:echo system('cat', 'here is some text')
here is some text
好吧,这看起来正确的。第二个测试:
:echo system('echo', 'here is some text')
<blank line>
而不是获取一些临时文件的名称,我有一个空行。此外,当我在我的node.js脚本中打印process.argv
时,我只得到['node', 'path/to/something.js', '--file']
。
我错过了{input}
参数如何使用?似乎为cat
工作,但不是echo
或我自己的脚本?
嘿downvoter。介意告诉我如何改善我的问题? – benekastah 2013-09-03 18:46:34