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

Powershell Pipeline Step hangs if capturing Stdout and output is null

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • durable-task-plugin
    • None
    • Jenkins 2.60.3
      Durable Task Plugin 1.14
      Windows Server 2012R2

      If the Powershell step is configured with 'returnStdout: true' and the script does not produce output, than [IO.File]::WriteAllLines fails when converting the temporaryOutput.txt, this causes the job to hang:

      [jaredtest] Running PowerShell script
      Cannot contact : java.nio.file.NoSuchFileException: D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\output.txt
      

      Pipeline script to recreate:

      node{
        def output = powershell(returnStdout: true, script: '')
        echo output
      }
      

      Executing `powershellWrapper.ps1` directly in the workspace results in the following error:

      PS H:\> D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1
      Exception calling "WriteAllLines" with "2" argument(s): "Value cannot be null.
      Parameter name: contents"
      At D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1:1 char:585
      + ... utput.txt"; [IO.File]::WriteAllLines("D:\Jenkins-Windows\workspace\ja ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ArgumentNullException
      

          [JENKINS-46508] Powershell Pipeline Step hangs if capturing Stdout and output is null

          Jared Kauppila created issue -
          Jared Kauppila made changes -
          Summary Original: Powershell Pipeline Step New: Powershell Pipeline Step hangs if capturing Stdout and output is null
          Gabriel Loewen made changes -
          Assignee New: Gabriel Loewen [ gabloe ]
          Gabriel Loewen made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-48175 [ JENKINS-48175 ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-48325 [ JENKINS-48325 ]
          Sam Van Oort made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Closed [ 6 ]

            gabloe Gabriel Loewen
            jakauppila Jared Kauppila
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: