ultimatepp/reference/SshBasics/Exec.cpp
oblivion eb8b93826b SshBasics (a reference example set for the SSH package) is added, and SFtpGet & SshExec examples are removed.
git-svn-id: svn://ultimatepp.org/upp/trunk@12171 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2018-08-17 20:14:36 +00:00

20 lines
No EOL
399 B
C++

#include "SshBasics.h"
// ExecListDir:
// Demonstrates a remote command execution.
void ExecListDir(SshSession& session)
{
const char *cmdline = "ls -l /pub/example";
SshExec exec(session);
String cout, cerr;
int exit_code = exec(cmdline, cout, cerr);
if(!exec.IsError()) {
DUMP(exit_code);
LOG("Stdout:\n" << cout);
LOG("Stderr:\n" << cerr);
return;
}
LOG(exec.GetErrorDesc());
}