Enum Class WindowsLoginShell

java.lang.Object
java.lang.Enum<WindowsLoginShell>
org.jenkinsci.plugins.proxmox.config.WindowsLoginShell
All Implemented Interfaces:
Serializable, Comparable<WindowsLoginShell>, Constable

public enum WindowsLoginShell extends Enum<WindowsLoginShell>
The login shell configured as the Windows agent's OpenSSH DefaultShell. It decides how the remoting start command must be quoted.

SSHLauncher launches the agent with a hardcoded cd "<workDir>" && java ... command. && is a valid statement separator in cmd.exe and in PowerShell 7+ (pwsh), so those shells run the command as-is. Windows PowerShell 5.x rejects it ("The token '&&' is not a valid statement separator in this version") and the agent JVM never starts. For PowerShell the command is wrapped as cmd /c '<command>': PowerShell treats the single-quoted body as one literal argument (so it never tries to parse &&) and hands it to cmd.exe, which runs cd "..." && java ... correctly. This was verified against a live Win32-OpenSSH PowerShell 5.1 shell; note PowerShell's --% stop-parsing token does NOT work over the OpenSSH exec channel, so it is not used.

AUTO (the default) detects the shell at launch instead of asking the user to pick it (see ProxmoxLauncher.detectWindowsShell); the explicit values remain as manual overrides. The prefix and suffix are applied via SSHLauncher.setPrefixStartSlaveCmd(java.lang.String) and SSHLauncher.setSuffixStartSlaveCmd(java.lang.String). Only relevant for Windows agents; Linux agents never wrap the command.

  • Enum Constant Details

    • AUTO

      public static final WindowsLoginShell AUTO
      Detect the shell at launch and wrap only if it rejects &&. Resolves to CMD or POWERSHELL.
    • CMD

      public static final WindowsLoginShell CMD
      cmd.exe (the OpenSSH default when no DefaultShell is set). Needs no wrapper.
    • POWERSHELL

      public static final WindowsLoginShell POWERSHELL
      PowerShell. Windows PowerShell 5.x cannot parse &&, so the command is wrapped as cmd /c '<command>'. The wrapper is a literal single-quoted string in every PowerShell version, so it is safe for both Windows PowerShell 5.x and PowerShell 7+.
  • Method Details

    • values

      public static WindowsLoginShell[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WindowsLoginShell valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDisplayName

      public String getDisplayName()
    • getStartCommandPrefix

      public String getStartCommandPrefix()
      Prefix prepended to SSHLauncher's agent-start command so it runs under this shell. Empty when the shell already accepts SSHLauncher's && syntax.
    • getStartCommandSuffix

      public String getStartCommandSuffix()
      Suffix appended to SSHLauncher's agent-start command (closes the wrapper, if any).