mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix tcsh path.
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
97fc7cf6fb
commit
ffce337827
@ -38,17 +38,12 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
|||||||
} else {
|
} else {
|
||||||
command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
|
command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
|
||||||
|
|
||||||
if (shellName === "tcsh") {
|
shellArgs = ["-l"];
|
||||||
shellArgs = ["-ic"];
|
|
||||||
} else {
|
|
||||||
shellArgs = ["-ilc"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const shellProcess = spawn(shell, [...shellArgs, command], {
|
const shellProcess = spawn(shell, [...shellArgs], {
|
||||||
detached: true,
|
detached: true,
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
|
||||||
env,
|
env,
|
||||||
});
|
});
|
||||||
const stdout: Buffer[] = [];
|
const stdout: Buffer[] = [];
|
||||||
@ -57,6 +52,10 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
|||||||
|
|
||||||
shellProcess.on("error", (err) => reject(err));
|
shellProcess.on("error", (err) => reject(err));
|
||||||
shellProcess.stdout.on("data", b => stdout.push(b));
|
shellProcess.stdout.on("data", b => stdout.push(b));
|
||||||
|
|
||||||
|
shellProcess.stdin.write(command);
|
||||||
|
shellProcess.stdin.end(command);
|
||||||
|
|
||||||
shellProcess.on("close", (code, signal) => {
|
shellProcess.on("close", (code, signal) => {
|
||||||
if (code || signal) {
|
if (code || signal) {
|
||||||
return reject(new Error(`Unexpected return code from spawned shell (code: ${code}, signal: ${signal})`));
|
return reject(new Error(`Unexpected return code from spawned shell (code: ${code}, signal: ${signal})`));
|
||||||
@ -64,6 +63,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const rawOutput = Buffer.concat(stdout).toString("utf-8");
|
const rawOutput = Buffer.concat(stdout).toString("utf-8");
|
||||||
|
|
||||||
const match = regex.exec(rawOutput);
|
const match = regex.exec(rawOutput);
|
||||||
const strippedRawOutput = match ? match[1] : "{}";
|
const strippedRawOutput = match ? match[1] : "{}";
|
||||||
const resolvedEnv = JSON.parse(strippedRawOutput);
|
const resolvedEnv = JSON.parse(strippedRawOutput);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user