Exit Full View

Feather2 / feather2-runtime / src / main / java / uk / co / nickthecoder / feather / runtime / command / Shell.java

package uk.co.nickthecoder.feather.runtime.command;

/**
 * The shell which will run the command.
 * Out of the box, only unix-style shells are supported (e.g. `bash`, `dash` etc.).
 *
 * <p>
 * If you want to use Commands under Windows you have two options :
 * </p>
 *
 * <ol>
 * <li>Install bash (or similar). (Recommended)</li>
 * <li>Create your own implementation of Shell. (Not recommended)</li>
 * </ol>
 *
 * <p>
 * The 2nd approach isn't recommended, because I don't think it is possible to use CMD.EXE
 * and escape special characters correctly. CMD.EXE is an ancient relic of the DOS era, and is very poorly designed.
 * </p>
 *
 * <p>
 * I have no knowledge of Window's PowerShell, but I don't think this is suitable either.
 * </p>
 *
 * <p>
 * I despair that Windows *still* doesn't have a proper shell out of the box.
 * </p>
 */
public interface Shell {

    /**
     * For ShShell, this returns ["sh", "-c", theCommand].
     */
    String[] buildShell(CommandBase command );

}