Open j3rem1e opened 2 years ago
Hi @j3rem1e, thanks for the report. Could you please explain what is GPO? What would you expect from mvnd in this situation? Maybe an explicit error message?
Sorry for the delay..
A GPO is a "Group Policy" on windows: an administrator can define rules on a windows domain. In my corporate environment, wmic is forbidden because of a GPO.
However, after reading the source, I think I was wrong and that wmic is not really required, the error seem to be correctly handled by mvnd. I have to search why mvnd doesn't work anymore on my computer (it was working with v0.7 but not v0.8)
mvnd seem to be locked, waiting for something, and mvnd --status :
ID PID Address Status RSS Last activity Java home
[main] WARN org.mvndaemon.mvnd.common.OsUtils - Could not execute wmic process where processid=11240 get WorkingSetSize
[main] WARN org.mvndaemon.mvnd.common.OsUtils - Unexpected output of wmic process where processid=11240 get WorkingSetSize:
8a8b25bc 11240 inet:/127.0.0.1:64317 Canceled -1k 2022-09-08T17:23:38.964 C:\Program Files\RedHat\java-11-openjdk-11.0.14-1
when using mvnd -e -Dmvnd.noBuffering=true clean install
I can see the build running normally. without this option, I don't have any progress in the console.
I ran into the same issue, likely because of a group policy.
While looking for solutions I noticed this:
Important
WMIC is deprecated as of Windows 10, version 21H1; and as of the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI; see Chapter 7 - Working with WMI. This deprecation applies only to the WMIC utility. Windows Management Instrumentation (WMI) itself is not affected. Also see Windows 10 features we're no longer developing.
WMIC: WMI command-line utility, Article, 07/15/2024
The Maven Daemon works though as expected. Just those warning messages.
Looks like the call is here? https://github.com/apache/maven-mvnd/blob/9f4b57be26a5a979fc9aebfc20e3c23e087f7648/common/src/main/java/org/mvndaemon/mvnd/common/OsUtils.java#L83
I am using both PowerShell and a normal Command Prompt (cmd.exe) with the same results.
Maybe a recommendation to turn off that particular warning message??
I ran into the same issue, likely because of a group policy.
While looking for solutions I noticed this:
Important WMIC is deprecated as of Windows 10, version 21H1; and as of the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI; see Chapter 7 - Working with WMI. This deprecation applies only to the WMIC utility. Windows Management Instrumentation (WMI) itself is not affected. Also see Windows 10 features we're no longer developing.
WMIC: WMI command-line utility, Article, 07/15/2024
The Maven Daemon works though as expected. Just those warning messages.
Looks like the call is here?
I am using both PowerShell and a normal Command Prompt (cmd.exe) with the same results.
Maybe a recommendation to turn off that particular warning message??
What about fixing the call ? I think it should roughly look like:
String[] cmd = {"powershell", "-Command", "Get-Process -Id " + pid + " | Select-Object -ExpandProperty WorkingSet" }
@gnodet , thanks for the quick note. What I have found for my environment:
TL;DR - I use both cmd.exe and powershell.exe command windows depending on the situation. Commands that work in one break the other (? - at least so far for me as I learn. ) Looks like two (2) issues then, which shell, what new command string.
Finding PowerShell ( if in cmd.exe window )
PATH
. Not sure if my Windows host is a normal setup.%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
PSHOME
environment variable, but that is not present on my system.v1.0
folder.Works from a Command Window ( cmd.exe )
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command "get-process -id 6448 | select-object -expandproperty workingset"
Works from a PowerShell Window ( powershell.exe )
get-process -id 6448 | select-object -expandproperty workingset
This article seems to provide a useful process for determining which shell is the process parent.
How do I determine if I'm in powershell or cmd?
C:\>(dir 2>&1 *`|echo CMD);&<# rem #>echo ($PSVersionTable).PSEdition
CMD
PS C:\> (dir 2>&1 *`|echo CMD);&<# rem #>echo ($PSVersionTable).PSEdition
Desktop
Hope this helps.
My environment has a GPO on wmic: I can't execute it with a user account.
mvnd doesn't show any output in this environment.