1 package org.apache.maven.it.util.cli.shell; 2 3 import java.util.Arrays; 4 import java.util.List; 5 6 /* 7 * Copyright 2001-2006 The Apache Software Foundation. 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 /** 23 * <p> 24 * Implementation to call the CMD Shell present on Windows NT, 2000 and XP 25 * </p> 26 * 27 * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a> 28 * @since 1.2 29 */ 30 public class CmdShell 31 extends Shell 32 { 33 public CmdShell() 34 { 35 setShellCommand( "cmd.exe" ); 36 setShellArgs( new String[]{"/X", "/C"} ); 37 } 38 39 /** 40 * Specific implementation that quotes the all the command line 41 */ 42 public List getCommandLine( String executable, String[] arguments ) 43 { 44 StringBuffer sb = new StringBuffer(); 45 sb.append( "\"" ); 46 sb.append( super.getCommandLine( executable, arguments ).get( 0 ) ); 47 sb.append( "\"" ); 48 49 return Arrays.asList( new String[]{sb.toString()} ); 50 } 51 52 }