mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
37 lines
No EOL
780 B
C++
37 lines
No EOL
780 B
C++
#include "SSH.h"
|
|
|
|
namespace Upp {
|
|
|
|
int SshExec::Execute(const String& cmd, String& out, String& err)
|
|
{
|
|
if(RequestExec(cmd)) {
|
|
int size = max(ssh->chunk_size, 1024);
|
|
out = Get(size);
|
|
err = GetStdErr(size);
|
|
if(Shut(IsError() ? GetErrorDesc() : Null))
|
|
return GetExitCode();
|
|
}
|
|
return GetError();
|
|
}
|
|
|
|
int SshExecute(SshSession& session, const String& cmd, String& out, String& err)
|
|
{
|
|
return SshExec(session).Execute(cmd, out, err);
|
|
}
|
|
|
|
int SshExecute(SshSession& session, const String& cmd, String& out)
|
|
{
|
|
String err;
|
|
int rc = SshExec(session).Execute(cmd, out, err);
|
|
if(!IsNull(err))
|
|
out.Cat(err);
|
|
return rc;
|
|
}
|
|
|
|
String SshExecute(SshSession& session, const String& cmd)
|
|
{
|
|
String out, err;
|
|
return SshExecute(session, cmd, out, err) ? String::GetVoid(): out;
|
|
}
|
|
|
|
} |