00001
00009
00010 package pkgMcj;
00011
00012 import java.util.*;
00013 import java.io.*;
00014 import pkgView.*;
00015
00016
00022 public class Cmd {
00023
00024 private Mcj mcj;
00025 private ScreenKit sk;
00026
00027
00031 public Cmd( Mcj parent){
00032 mcj = parent;
00033 sk = ScreenKit.getSingleton();
00034 }
00035
00036
00037
00041 public boolean doCmd( String cmdStr ) {
00042 Process proc;
00043 if( cmdStr == null ){
00044 mcj.errorMsg("command string is null" );
00045 return false;
00046 }
00047
00048 try {
00049 Runtime runtime = Runtime.getRuntime();
00050 proc = runtime.exec( cmdStr );
00051 }
00052 catch(IOException e) {
00053 mcj.errorMsg("Error executing " + cmdStr );
00054 return(false);
00055 }
00056
00057 try {
00058 proc.waitFor();
00059 }
00060 catch( InterruptedException e ){
00061 mcj.errorMsg("Error executing /bin/shell " );
00062 return(false);
00063 }
00064 mcj.logFile.putString("Command: " + cmdStr );
00065 return true;
00066 }
00067
00068
00069
00070 }