mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 336013: [launch] Environment variables that contain a space are not properly set at launch time
This commit is contained in:
parent
54ef22fda2
commit
9c4c909ba9
1 changed files with 11 additions and 8 deletions
|
@ -32,13 +32,16 @@ public class MIGDBSetEnv extends MIGDBSet
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIGDBSetEnv(ICommandControlDMContext dmc, String name, String value) {
|
public MIGDBSetEnv(ICommandControlDMContext dmc, String name, String value) {
|
||||||
// We need to avoid putting "" around the variable.
|
// MICommand wraps a parameter with double quotes if it contains a space. If the
|
||||||
|
// value of the environment variable has a space, and we bundle the var name, the
|
||||||
|
// '=' and the value as a single parameter, then we'll end up with something like
|
||||||
|
//
|
||||||
// -gdb-set env "MYVAR=MY VAR"
|
// -gdb-set env "MYVAR=MY VAR"
|
||||||
// will not set MYVAR to MY VAR, but instead will create an empty variable with name "MYVAR=MY VAR"
|
//
|
||||||
// This is because "" are automatically inserted if there is a space in the parameter.
|
// which defines an environment variable named "MYVAR=MY VAR", with an empty
|
||||||
// What we really want to send is:
|
// string for a value. To avoid this, we send each element as a separate parameter
|
||||||
|
//
|
||||||
// -gdb-set env MYVAR = MY VAR
|
// -gdb-set env MYVAR = MY VAR
|
||||||
// To achieve that, we split the value into separate parameters
|
|
||||||
super(dmc, null);
|
super(dmc, null);
|
||||||
|
|
||||||
if (value == null || value.length() == 0) {
|
if (value == null || value.length() == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue