You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2023/01/31 20:26:00 UTC

[jira] [Commented] (MNG-7674) Windows mvn.cmd should call cmd.exe explicitly

    [ https://issues.apache.org/jira/browse/MNG-7674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17682736#comment-17682736 ] 

Michael Osipov commented on MNG-7674:
-------------------------------------

Patches welcome.

> Windows mvn.cmd should call cmd.exe explicitly
> ----------------------------------------------
>
>                 Key: MNG-7674
>                 URL: https://issues.apache.org/jira/browse/MNG-7674
>             Project: Maven
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 3.8.6, 3.8.7
>            Reporter: Fei Dai
>            Priority: Trivial
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> Summary:
> As I saw in 3.8.6, on Windows, in mvn.cmd, line 200, it starts with:
> {code:java}
> cmd /C... {code}
>  
> It can reach the system "cmd.exe" correctly most of the time.
> However, in one of my project root directory, I accidently made a "cmd.bat", which is used by eclipse to enter the project directory quickly. Then the above quoted code will hit my code instead of the expected one.
> ----
> Steps to reproduce problem:
> in the root directory of a maven project, create cmd.bat, with 1-line content
> {code:java}
> cmd /k cd %~dp0 {code}
> If running it from eclipse, because eclipse run it from "C:\windows\system32", it will correctly open the command-line.
> If running "mvn" in the root directory, with current line 200, the mvn.cmd will go into this cmd.bat, and it will then enter itself, and cause infinite loop.
> This problem might not be that easy to locate, because after writing that cmd.bat, it works as expected in Eclipse. At the same time, when mvn.bat goes into infinite loop, there's no special prompt, and all works of mvn.bat are done already.
> ----
> Recommended fix:
> In that line 200, change it to start with:
> {code:java}
> cmd.exe /C...{code}
> by adding ".exe"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)