Exec plugin does not work with PowerShell
-----------------------------------------
Key: MEXEC-94
URL: https://jira.codehaus.org/browse/MEXEC-94
Project: Maven 2.x Exec Plugin
Issue Type: Bug
Components: exec
Affects Versions: 1.2
Environment: Windows
Reporter: Peter Johnson
Priority: Minor
Attachments: execpatch.zip
The exec plugin maps stdin to System.in when it runs a process. Unfortunately,
if you call PowerShell while remapping stdin, PowerShell never exits after it
finishes the script and simply waits for the user to enter something. Thus if
you configure exec to run PowerShell, you have to hit enter after PowerShell
does its thing to get the Maven build to continue.
Additionally, it seems that it would be a good idea to provide a mechanism to
feed canned input to apps that want such input.
The attached patch adds an inputFile parameter to exec:exec. It accepts two
keywords: "null" to set stdin to null (which is sufficient to get PowerShell to
exit properly), "stdin" which is the default and maps System.in to stdin (thus
retaining the existing functionality). It also accepts a file name, in which
case the file is mapped to stdin.
The attached zip file contains the patch (I apologize that I did not provide
any unit test cases, I wasn't quite sure how to extend the existing unit
tests). The zip file also contains an Eclipse project that I used to test the
patch. To test, simply cd to the exectest directory and enter:
mvn -f pom-default.xml (PowerShell will hang because default is System.in,
press enter to continue)
mvn -f pom-default.xml -Dexec.inputFile=null (PowerShell will exit
automatically)
mvn -f pom-null.xml (PowerShell will exit automatically)
mvn -f pom-input.xml (The exec plugin will run the included Java app passing
the file named 'input' to stdin)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email