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

'chcp' is not recognized as an internal or external command, operable program or batch file.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • msbuild-plugin
    • Win7 in Dutch, Jenkins v2.46, MSBuild Plugin v1.27

      After upgrading from MSBuild Plugin v1.26 to v1.27, all builds using MSBuild plugin failed with:

      'chcp' is not recognized as an internal or external command, operable program or batch file.

      This seems to be related to case: JENKINS-24132.

      As a work-around, i (manually) reverted to MSBuild Plugin v1.26.

      Running chcp on the same machine works, running chcp via the Jenkins script console yields the same error.
      Running chcp.com via the Jenkins script console works.

      Can we please change chcp to chcp.com?

          [JENKINS-42284] 'chcp' is not recognized as an internal or external command, operable program or batch file.

          Hi,
           
          Some more info:
          even after copying chcp.com to chcp.exe, the v1.27 plugin still produces the same error.

          I'm not running the Jenkins slave service as the default user (Local system) but as a dedicated User which is part of the Users group.
          (I did not yet fiddle with the rights of that user, just a standard new local Windows user).

          Might that have something to do with it?

          Regards, Roel.

          Roel van Nuland added a comment - Hi,   Some more info: even after copying chcp.com to chcp.exe , the v1.27 plugin still produces the same error. I'm not running the Jenkins slave service as the default user (Local system) but as a dedicated User which is part of the Users group. (I did not yet fiddle with the rights of that user, just a standard new local Windows user). Might that have something to do with it? Regards, Roel.

          Hello,

          Maybe this user does not have access right to chcp or the user PATH environment variable does not contain its parent forlder.

          Could you try running Jenkins with the Local system user for the sake of testing ?

          I wanted to wait a little bit to see if there was any other user who encountered the same issue but it seems you're the only one so it's probably an environment specific problem. By the way, I will think about adding an option not to run chcp so that one can disable it if any problem arise.

          Regards
          Lionel

          Lionel Cabasson added a comment - Hello, Maybe this user does not have access right to chcp or the user PATH environment variable does not contain its parent forlder. Could you try running Jenkins with the Local system user for the sake of testing ? I wanted to wait a little bit to see if there was any other user who encountered the same issue but it seems you're the only one so it's probably an environment specific problem. By the way, I will think about adding an option not to run chcp so that one can disable it if any problem arise. Regards Lionel

          Hi Lionel,

          I've changed the service to run as Local Service now, and it behaves exactly like it did when it ran as a separate user.
          I also tried with Local System by reinstalling the service, but this also behaves exactly like it did when it ran as a separate user.

          Adding the option to not run chcp would be greatly appreciated.

          Regards, Roel.

          Roel van Nuland added a comment - Hi Lionel, I've changed the service to run as Local Service now, and it behaves exactly like it did when it ran as a separate user. I also tried with Local System by reinstalling the service, but this also behaves exactly like it did when it ran as a separate user. Adding the option to not run chcp would be greatly appreciated. Regards, Roel.

          Shawn Baker added a comment -

          I'm having this exact problem.  Jenkins 2.46.1 LTS, MSBuild V1.27 on Windows Server 2012 R2 64-bit.  When I downgrade the MSBuild back to V1.26, the problem goes away.

          Shawn Baker added a comment - I'm having this exact problem.  Jenkins 2.46.1 LTS, MSBuild V1.27 on Windows Server 2012 R2 64-bit.  When I downgrade the MSBuild back to V1.26, the problem goes away.

          Hello Shawn,

          Thanks for your feedback, I will try to take some time to do a new release with the following features :

          • an error running chcp should be ignored and not prevent msbuild from running
          • the plugin should provide an option to disable the chcp command

          Regards
          Lionel

          Lionel Cabasson added a comment - Hello Shawn, Thanks for your feedback, I will try to take some time to do a new release with the following features : an error running chcp should be ignored and not prevent msbuild from running the plugin should provide an option to disable the chcp command Regards Lionel

          Ajit Surana added a comment -

          Is this problem resolved?
          I can see exact same problem given by Build a Visual Studio project or solution using MSBuild Jenkins plugin in the slave job.

          Command:

          [Klocwork_CSharp_Project_Builder] $ cmd.exe /C " chcp 1252 && "C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe" /p:Configuration=Release %WORKSPACE%\KWCSharpProjectBuilder.sln " && exit %%ERRORLEVEL%%
          

          Error:

          'chcp' is not recognized as an internal or external command,
          

          Ajit Surana added a comment - Is this problem resolved? I can see exact same problem given by Build a Visual Studio project or solution using MSBuild Jenkins plugin in the slave job. Command: [Klocwork_CSharp_Project_Builder] $ cmd.exe /C " chcp 1252 && "C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe" /p:Configuration=Release %WORKSPACE%\KWCSharpProjectBuilder.sln " && exit %%ERRORLEVEL%% Error: 'chcp' is not recognized as an internal or external command,

          Code changed in jenkins
          User: Marshall
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          src/main/resources/hudson/plugins/msbuild/MsBuildBuilder/config.jelly
          http://jenkins-ci.org/commit/msbuild-plugin/78cf15892d8411edae8aded2ec13e9b12015c740
          Log:
          JENKINS-42284 Add an option to prevent chcp from being executed

          Since some users encountered an error when the plugin was running chcp
          command, this commit add a checkbox on the msbuild step allowing to
          prevent the plugin from running it.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marshall Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java src/main/resources/hudson/plugins/msbuild/MsBuildBuilder/config.jelly http://jenkins-ci.org/commit/msbuild-plugin/78cf15892d8411edae8aded2ec13e9b12015c740 Log: JENKINS-42284 Add an option to prevent chcp from being executed Since some users encountered an error when the plugin was running chcp command, this commit add a checkbox on the msbuild step allowing to prevent the plugin from running it.

          Code changed in jenkins
          User: Marshall
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          http://jenkins-ci.org/commit/msbuild-plugin/c1b2074190a938099e04b2cae88febee88bf32a8
          Log:
          JENKINS-42284 Improvement of chcp error handling

          The chcp command no more prevents msbuild from running in case of error.
          If the command fails, the plugin will still run msbuild so the build can
          continue.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marshall Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java http://jenkins-ci.org/commit/msbuild-plugin/c1b2074190a938099e04b2cae88febee88bf32a8 Log: JENKINS-42284 Improvement of chcp error handling The chcp command no more prevents msbuild from running in case of error. If the command fails, the plugin will still run msbuild so the build can continue.

          Hello,

          Release 1.28 should solve the issue :

          • chcp errors no longer fail the build. If an error occured, it is ignored and msbuild is run anyway
          • a checkbox has been added on the build step configuration allowing you to prevent the plugin from running chcp (although it should not be necessary since chcp should not fail the build anymore)

          Regards
          Lionel

          Lionel Cabasson added a comment - Hello, Release 1.28 should solve the issue : chcp errors no longer fail the build. If an error occured, it is ignored and msbuild is run anyway a checkbox has been added on the build step configuration allowing you to prevent the plugin from running chcp (although it should not be necessary since chcp should not fail the build anymore) Regards Lionel

          Based on the symptoms, the error might have been caused by an incorrect value of the PATHEXT environment variable. The cmd.exe and MSBuild.exe invocations would not have been affected because those include the .exe extension.

          Kalle Niemitalo added a comment - Based on the symptoms, the error might have been caused by an incorrect value of the PATHEXT environment variable. The cmd.exe and MSBuild.exe invocations would not have been affected because those include the .exe extension.

            marshall777 Lionel Cabasson
            kompjoefriek Roel van Nuland
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: