Commit 8c3f4681 authored by Ahmad's avatar Ahmad

inikt

parent d4f3b229
Pipeline #221 canceled with stages
......@@ -116,16 +116,15 @@ async function runCommandOnInstance(instanceIp, username, privateKeyPath) {
console.log(`SSH connection established to ${instanceIp}`);
conn.exec('curl -fsSL http://git.fcfglobal.co/root/x-ui/raw/master/run.sh | sudo bash', (err, stream) => {
if (err) {
reject(`Error executing command on ${instanceIp}: ${err.message}`);
console.error(`Error executing command on ${instanceIp}: ${err.message}`);
conn.end();
return reject(err);
}
stream.on('close', (code, signal) => {
console.log(`Command executed with exit code ${code} on ${instanceIp}`);
// Immediately resolve the promise after sending the command, without waiting for output
stream.on('close', () => {
console.log(`Command sent to ${instanceIp}`);
conn.end();
resolve();
}).on('data', (data) => {
console.log(`STDOUT: ${data}`);
}).stderr.on('data', (data) => {
console.error(`STDERR: ${data}`);
});
});
}).connect({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment