0

If I execute jdksjdkd in terminal from one machine to another machine using paramiko I am getting stderr.readlines() as Command not found.

1
  • That "command not found" is usually printed by the shell to its stderr. That's probably how.
    – muru
    Jun 27 '18 at 6:40
3

The PATH environment variable indicates that where the commands resides. So in your case , since "jdksjkdk" is not found in the $PATH , it throws error on STDERR file descriptor and hence you are getting stderr.readiness() as Command not found

Explanation: There are 3 standard file descriptors, every running program in linux opens the following file descriptors

  1. STDIN (0) => for standard input
  2. STDOUT(1) => for standard output
  3. STDERR (2) => for standard error

So when the command was not found, the error was written to STDERR ( file desciptor => 2 ) , if it was successful, then output would had been written to STDOUT ( file descriptor => 1 ) . Since paramiko is reading result from STDERR and not STDOUT , this is how it is verifying it is error not output

2
  • I believed the above statement. but in one of my case I am getting stdout(output) as stderr message. The data got swapped between this two. So that I raised this question. Jun 27 '18 at 6:31
  • Maybe then it must be checking the return status of your process to check if it failed or not
    – Arushix
    Jun 27 '18 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.