[intellij sh] IDEA-283506 Properly handle setting env variables for scripts at run configuration

GitOrigin-RevId: e8f86160b04612c49e165d8c2a0f52414f783f25
This commit is contained in:
Mikhail Mazurkevich
2021-12-08 21:21:18 +00:00
committed by intellij-monorepo-bot
parent 14398ed768
commit 03709e0c05
@@ -209,9 +209,12 @@ final class ShRunConfigurationProfileState implements RunProfileState {
String escapedValue = StringUtil.escapeQuotes(value);
quotedString = StringUtil.containsWhitespaces(value) ? StringUtil.QUOTER.apply(escapedValue) : escapedValue;
}
if (endWithSemicolon && index == envs.size() - 1) {
commandLine.add(key + "=" + quotedString + ";");
} else {
if (endWithSemicolon) {
String semicolon = "";
if (index == envs.size() - 1) semicolon = ";";
commandLine.add("export " + key + "=" + quotedString + semicolon);
}
else {
commandLine.add(key + "=" + quotedString);
}
index++;