ultimatepp/reference/SshBasics/Exec.cpp
oblivion 76f1f988f0 reference: SshBasics example updated, reflectiong the new helper functions for SshExec class
git-svn-id: svn://ultimatepp.org/upp/trunk@14074 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-02-24 13:37:18 +00:00

23 lines
No EOL
511 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());
// Or you can use one of the helper functions instead:
// LOG("Stdout:\n" << SshExecute(session, cmdline));
}