Skip to content

Commit

Permalink
Fix mac ENVI crash bug for missing environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
znorman-harris committed Oct 25, 2023
1 parent f3fbd50 commit b1fa3cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Renamed "Additional Actions" sidebar to "Quick Access" and updated the icon used

Resolve an edge case when running notebooks where a false-failure would be detected that halts notebook execution.

Fixed an issue when launching IDL on Mac where ENVI crashes because "LANG" is missing from the environment

## 3.2.3 September 2023

Re-work cancellation to handle cases where the worker threads were too busy to get the messages that work needs to be stopped. If you now use a very large file (take "slicer3.pro" from the IDL distribution) events are interrupted as expected.
Expand Down
12 changes: 11 additions & 1 deletion libs/idl/src/lib/idl.class.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Logger } from '@idl/logger';
import { CleanPath } from '@idl/shared';
import { IDL_TRANSLATION } from '@idl/translation';
import { ChildProcess, spawn } from 'child_process';
import { ChildProcess, execSync, spawn } from 'child_process';
import { EventEmitter } from 'events';
import copy from 'fast-copy';
import { existsSync } from 'fs';
Expand Down Expand Up @@ -162,6 +162,15 @@ export class IDL extends EventEmitter {
// since this controls parsing
args.env.IDL_PROMPT = 'IDL> ';

// check if we need to manage the language environment variable
if (os.platform() === 'darwin') {
if (!('LANG' in args.env)) {
args.env['LANG'] = `${execSync(`defaults read -g AppleLocale`)
.toString()
.trim()}.UTF-8`;
}
}

// build the command for starting IDL
const cmd = `${args.config.IDL.directory}${path.sep}idl`;

Expand All @@ -175,6 +184,7 @@ export class IDL extends EventEmitter {
dir: args.env.IDL_DIR,
path: args.env.IDL_PATH,
dlm_path: args.env.IDL_DLM_PATH,
env: args.env,
},
],
});
Expand Down

0 comments on commit b1fa3cc

Please sign in to comment.