Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Bash under Windows #96

Open
mikehenry-io opened this issue May 28, 2019 · 4 comments
Open

Problems with Bash under Windows #96

mikehenry-io opened this issue May 28, 2019 · 4 comments

Comments

@mikehenry-io
Copy link

Hi,
We have been using the Maven plugin, which uses this Ant plugin for shell/OS interaction, and are experiencing some problems running under (Git) Bash on Windows.
The behavior is that on all Windows shells, the StartServer Mojo, for example, will run the "server.bat" script.
We think it would be reasonable (and desirable) when running under Bash, regardless if it is under Windows, that the corresponding "server", etc. scripts be run, and not the ones with the ".bat" suffix.
Thank you in advance!
-Mike

@scottkurz
Copy link
Member

scottkurz commented May 28, 2019

Mike, just trying to understand your motivation a bit better. Can you give an example or idea of what problem you were experiencing using wlp\bin\server.bat which would be addressed by using wlp/bin/server ? Thanks.

@mikehenry-io
Copy link
Author

mikehenry-io commented May 28, 2019

Thanks Scott! Many companies and organizations have Windows group-policies limiting the running of arbitrary BAT-files. However, when shells like Bash are allowed so are shell-based commands.

@scottkurz
Copy link
Member

The ci.ant project uses this code to detect "isWindows" which is the flag we use to determine to call .bat scripts, (instead of the /bin/sh scripts).

         osName = System.getProperty("os.name", "unknown").toLowerCase();
         isWindows = osName.indexOf("windows") >= 0;

and we consistently use the same code in the ci.common, ci.maven, and ci.gradle projects (as well as the newer boost project).

So say we were to use some other flag (either via an external or an auto-detection of what shell we're running in), how would this impact our code?

I took a first pass at the ci.common, ci.maven, and ci.gradle projects to see how they could be impacted and it seems they would rather trivially just call the /bin/sh scripts.

So it seems the only Liberty plugin code that's uses an "isWindows" flag to do something more than decide which script to call is the code in ci.ant's AbstractTask.java, (e.g. here).

So AbstractTask.java would be something to look at, as we think about the implications of this idea.

@scottkurz
Copy link
Member

In addition to my comments above, also note we should look into why the isWindows=true path sets:
processBuilder.environment().put("EXIT_ALL", "1");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants