Author Topic: CkSsh: How to get stderr from a QuickShell (remote shell PTY session).  (Read 7685 times)


  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile

I wonder if it is possible to get the stderr (GetReceivedStderrText) separately from stdout (GetReceivedText)?

I'm trying to do this by:

 1. For CkSsh object, I do "ssh->put_StderrToStdout(false);"

 2. To request the shell, I do "int channel = ssh->QuickShell();"

 3. To get the output I do:

Code: [Select]
*std_out = ssh->getReceivedText(channel, "ansi");
if (!ssh->get_LastMethodSuccess()) {
    cerr << "error" << std::endl; 

*std_err = ssh->getReceivedStderrText(channel, "ansi");
if (!ssh->get_LastMethodSuccess()) {
    cerr << "error" << std::endl;

However, I just get both stdout and stderr together in getReceivedText. Please notice that a similar approach works for connections where I don't request a shell/pty (a.k.a using ssh->SendReqExec).

Thanks for the time and help.