In the lib/builder/linux.js file at line 121, the getSpawnOptions function sets the LANG environment variable to 'C' within the spawned process. However, this modification affects the environment of the main process as well, potentially causing unintended consequences for subsequent child processes.
Suggested Improvement:
Instead of directly modifying the process.env object with Object.assign, it's advisable to create a new object for the environment variables specific to the spawned process. This ensures that modifications are localized and do not affect the main process environment.
Proposed Code Change:
builder.getSpawnOptions = function () {
return {
shell: false,
env: Object.assign({}, process.env, {LANG: 'C'}), // Create a new object to avoid modifying the main process environment
};
};
This change prevents unintended modifications to the main process environment and ensures that only the spawned process environment is affected by the LANG setting.
Issue Description:
In the lib/builder/linux.js file at line 121, the getSpawnOptions function sets the LANG environment variable to 'C' within the spawned process. However, this modification affects the environment of the main process as well, potentially causing unintended consequences for subsequent child processes.
Suggested Improvement:
Instead of directly modifying the process.env object with Object.assign, it's advisable to create a new object for the environment variables specific to the spawned process. This ensures that modifications are localized and do not affect the main process environment.
Proposed Code Change:
This change prevents unintended modifications to the main process environment and ensures that only the spawned process environment is affected by the LANG setting.