public BourneShell( boolean isLoginShell ) { setUnconditionalQuoting( true ); setShellCommand( "/bin/sh" ); setArgumentQuoteDelimiter( '\'' ); setExecutableQuoteDelimiter( '\'' ); setSingleQuotedArgumentEscaped( true ); setSingleQuotedExecutableEscaped( false ); setQuotedExecutableEnabled( true ); setArgumentEscapePattern( "'\\%s'" ); if ( isLoginShell ) { addShellArg( "-l" ); } }
@Override public String[] getShellArgs() { String[] shellArgs = super.getShellArgs(); if ( shellArgs == null ) { shellArgs = new String[ 0 ]; } return shellArgs; }
@Override public List< String > getShellArgsList() { List< String > shellArgs = new ArrayList< String >(); List< String > existingShellArgs = super.getShellArgsList(); if ( existingShellArgs != null && !existingShellArgs.isEmpty() ) { shellArgs.addAll( existingShellArgs ); } return shellArgs; }
protected String getExecutionPreamble() { if ( getWorkingDirectoryAsString() == null ) { return null; } String dir = getWorkingDirectoryAsString(); StringBuilder sb = new StringBuilder(); sb.append( "cd " ); sb.append( quoteOneItem( dir, false ) ); sb.append( " && " ); return sb.toString(); }
/** {@inheritDoc} */ public String getExecutable() { if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) { return super.getExecutable(); } return quoteOneItem( super.getOriginalExecutable(), true ); }
/** * <p> * Sets the shell or command-line interpreter for the detected operating system, and the shell arguments. * </p> */ private void setDefaultShell() { // If this is windows set the shell to command.com or cmd.exe with correct arguments. if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) { if ( Os.isFamily( Os.FAMILY_WIN9X ) ) { setShell( new CommandShell() ); } else { setShell( new CmdShell() ); } } else { setShell( new BourneShell() ); } }