请问这个python代码的node.js等效

时间:2018-08-03 16:25:13

标签: python node.js

此python代码的node.js代码等效什么?

python -c 'import pty;
pty.spawn("/bin/sh")'

我正在尝试获取linux shell,并尝试了以下代码:

var exec = require('child_process').exec;
exec('/bin/bash', function (error, stdOut, stdErr) {console.log(stdOut);});

1 个答案:

答案 0 :(得分:0)

@bot.event async def on_member_join(member): print("A member just joined and his name is" + member.name) general = bot.get_channel(466675715333554179) mid = member.id await general.send('Welcome <@%s> to OnePlix server, I am Cooler!' % (mid)) 模块还包含 spawn 方法。您可以尝试一下,它比 exec 更加灵活。