title: SSH command in Java/JSch giving exit code -1
body: <p>I am checking file modified status of a server remotely using JSch in Java. apart from the output, i am also checking exit code.
  While the test server is running fine and giving exit code as 0, the production server is throwing exit code -1. How do i get more details on this -1 and its meaning.</p>
  
  <p>Here is my code, with sensitive areas removed.<br>
  How do I get more details on the last line <code>getExitStatus</code>.</p>
  
  <pre><code>JSch js=new JSch(); 
  Session s = js.getSession(username, host, 22);
  s.setPassword(password);
  
  Properties ssconfig = new Properties();
  ssconfig.put("StrictHostKeyChecking", "no");
  s.setConfig(ssconfig);
  s.connect();
  
  Channel c = s.openChannel("exec");
  ChannelExec ce = (ChannelExec) c;
  
  ce.setCommand("cd &lt;some file dir&gt; &amp;&amp; date &amp;&amp; ls -ltr");
  ce.setErrStream(System.err);
  
  ce.connect();
  
  /*
   * temporary test print
   */
  BufferedReader reader = new BufferedReader(new InputStreamReader(ce.getInputStream()));
  String line;
  while ((line = reader.readLine()) != null) {
    System.out.println(line);
  }
  
  /*
   * end of temporary print
   */
  ce.disconnect();
  s.disconnect();
  
  System.out.println("Exit code: " + ce.getExitStatus());
  
  return ce.getExitStatus();
  </code></pre>