Fixed bug where child process does not set TERM env variable if env block is passed to child.

Bryan Roe committed Aug 10, 2021 at 15:00 UTC d70665e7d6fd618a7b66ae09801514d97abb60e7
2 files changed +29
agents/meshcore.js
+15
@@ -94,6 +94,21 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) {
94 } catch (e) { }
95 }
96
97 +if (process.platform != 'win32')
98 +{
99 + var ch = require('child_process');
100 + ch._execFile = ch.execFile;
101 + ch.execFile = function execFile(path, args, options)
102 + {
103 + if(options && options.type && options.type == ch.SpawnTypes.TERM && options.env)
104 + {
105 + options.env['TERM'] = 'xterm-256color';
106 + }
107 + return (this._execFile(path, args, options));
108 + };
109 +}
110 +
111 +
112 if (process.platform == 'darwin' && !process.versions) {
113 // This is an older MacOS Agent, so we'll need to check the service definition so that Auto-Update will function correctly
114 var child = require('child_process').execFile('/bin/sh', ['sh']);
agents/recoverycore.js
+14
@@ -28,6 +28,20 @@ catch(x)
28
29 }
30
31 +if (process.platform != 'win32')
32 +{
33 + var ch = require('child_process');
34 + ch._execFile = ch.execFile;
35 + ch.execFile = function execFile(path, args, options)
36 + {
37 + if (options && options.type && options.type == ch.SpawnTypes.TERM && options.env)
38 + {
39 + options.env['TERM'] = 'xterm-256color';
40 + }
41 + return (this._execFile(path, args, options));
42 + };
43 +}
44 +
45 function _getPotentialServiceNames()
46 {
47 var registry = require('win-registry');