From bd84e07bc62eb24a354c659d5ebf618fcc5bcf60 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 5 Dec 2013 16:16:51 -0500 Subject: [PATCH] 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 IP-Clean: Jeff Johnston Tested-by: Jeff Johnston --- .../core/AutotoolsNewMakeGenerator.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java index 10e703376f0..2d3c4106517 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java @@ -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 envList = new ArrayList(); + 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)