我是AWS lambda,lex和node-js的新手,所以这是一个非常基本的问题:
我正在尝试编写一个node-js lambda函数,该函数将简单的命令输出返回到test-bot(lex),我能够将正确的输出记录到cloud-watch但是同样没有返回测试 - 机器人 - 我相信我必须使用类似回调的东西(我能够将硬编码字符串返回到自动机器人但不能返回我的命令的输出)但不知道如何使用它,下面是我试图的代码片段跑,你能不能。帮助
var SSH = require('simple-ssh')
var ssh_test = new SSH({
host: 'xx.xx.xx.xx',
user: 'xyz',
pass: 'xyz'
});
exports.handler = (event, context, callback) => {
var test = event.currentIntent.slots.purchase,
ssh_test.exec('ls /tmp/', {
out: console.log.bind(console)
})
.exec('exit', {
out: console.log.bind(console)
}).start();
callback(null, {
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "PlainText",
"content": "I AM ABLE TO RETURN THIS HARDCODED STRING TO BOT" //ALONG WITH THIS I WANT TO APPEND COMMAND OUTPUT ('ls /tmp/')
}
}
});
}
答案 0 :(得分:2)
试试这个,
<Product ...Some stuff here ... >
<Property Id="ALREADYINSTALLED">
<RegistrySearch Id="InstallPath"
Key="Software\$(var.MainDir)\$(var.SecondaryDir)"
Name="InstallFolder"
Root="HKCU"
Type="directory"
Win64="$(var.Win64)"/>
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UI>
<UIRef Id="WixUI_InstallDir"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2"> <![CDATA[NOT ALREADYINSTALLED]]> </Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2"> <![CDATA[NOT ALREADYINSTALLED]]> </Publish>
/!\ Interesting part here /!\
<Publish Dialog="WelcomeDlg" Control="Next" Event="SetTargetPath" Value="[ALREADYINSTALLED]" Order="2"> <![CDATA[ALREADYINSTALLED]]> </Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2"> <![CDATA[ALREADYINSTALLED]]> </Publish>
</UI>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="SAFEFOLDER" Name="$(var.MainDir)">
<Directory Id="INSTALLFOLDER" Name="$(var.SecondaryDir)" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Component ... Some stuff here ... >
<RegistryValue Root="HKCU"
Key="Software\$(var.MainDir)\$(var.SecondaryDir)"
Name="InstallFolder"
Type="string"
Value="[INSTALLFOLDER]"
KeyPath="yes" />
... Some other stuff here ...
</Component>