Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63153

Jenkins powershell-plugin 1.4 breaks code with param()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • powershell-plugin
    • None

      When Powershell-plugin 1.4 creates a temp Powershell script file, it inserts a new line of code as the first line of the file. The new line is either,
      $ErrorActionPreference="Continue" (When "Stop on Errors" option is unchecked)
      or,
      $ErrorActionPreference="Stop" (When "Stop on Errors" option is checked)

      This insertion breaks original code with param() because it must be the first line. An exception was thrown saying, "The term 'param' is not recognized as the name of a cmdlet, function, script file, or operable program.".

      The "ErrorActionPreference" line should be taken off, code developers can certainly manage it by themselves. Or, it should be inserted after the param() block.

            froque Filipe Roque
            luckyhsif Roger Huang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: