function promiseExec(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error);
}
resolve(stdout ? stdout : stderr);
});
});
}
(async () => {
await promiseExec(`ssh -i [pem key] [name]@[ip] [command]`);
})()
Created
September 24, 2019 09:54
-
-
Save koo6357/e2a59048840c669f7e57381b861f08ab to your computer and use it in GitHub Desktop.
run command remotely with async
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment