1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Bug 423192 - Fix AutotoolsNewMakeGenerator getWinOSType method

- Fix AutotoolsNewMakeGenerator.getWinOSType method to
  use the build env variables when invoking the sh
  command because the path to "sh" may be specified there

Change-Id: Ibcde5de924c50b6557fb4264572ddd59b02bb99a
Reviewed-on: https://git.eclipse.org/r/19400
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
IP-Clean: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
Jeff Johnston 2013-12-05 16:16:51 -05:00
parent 4dab99404c
commit bd84e07bc6

View file

@ -996,10 +996,24 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
try {
CommandLauncher launcher = new CommandLauncher();
ByteArrayOutputStream out = new ByteArrayOutputStream();
// Fix Bug 423192 - use environment variables when checking the Win OS Type using
// a shell command as the path to sh may be specified there
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = new String[0];
ArrayList<String> envList = new ArrayList<String>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
envList.add(variables[i].getName()
+ "=" + variables[i].getValue()); //$NON-NLS-1$
}
env = (String[]) envList.toArray(new String[envList.size()]);
}
launcher.execute(
new Path(SHELL_COMMAND), //$NON-NLS-1$
new String[] { "-c", "echo $OSTYPE" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[0],
env,
new Path("."), //$NON-NLS-1$
new NullProgressMonitor());
if (launcher.waitAndRead(out, out) == CommandLauncher.OK)