James Moger
2014-03-27 ab07d0d86d8b64b4f7c88b45bc81f1eec22105db
src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java
@@ -18,28 +18,32 @@
import java.io.PrintWriter;
import org.apache.sshd.server.Environment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class SshCommand extends BaseCommand {
  protected PrintWriter stdout;
  protected PrintWriter stderr;
  @Override
  public void start(Environment env) throws IOException {
    startThread(new CommandRunnable() {
      @Override
      public void run() throws Exception {
        parseCommandLine();
        stdout = toPrintWriter(out);
        stderr = toPrintWriter(err);
        try {
          SshCommand.this.run();
        } finally {
          stdout.flush();
          stderr.flush();
        }
      }
    });
  }
   protected Logger log = LoggerFactory.getLogger(getClass());
   protected PrintWriter stdout;
   protected PrintWriter stderr;
  protected abstract void run() throws UnloggedFailure, Failure, Exception;
   @Override
   public void start(Environment env) throws IOException {
      startThread(new CommandRunnable() {
         @Override
         public void run() throws Exception {
            parseCommandLine();
            stdout = toPrintWriter(out);
            stderr = toPrintWriter(err);
            try {
               SshCommand.this.run();
            } finally {
               stdout.flush();
               stderr.flush();
            }
         }
      });
   }
   protected abstract void run() throws UnloggedFailure, Failure, Exception;
}