git: isolate ipc env

This commit is contained in:
Joao Moreno
2019-11-20 16:06:55 +01:00
parent af864aed2f
commit f37b9d742c
5 changed files with 22 additions and 12 deletions

View File

@@ -20,10 +20,6 @@ function main(argv: string[]): void {
return fatal('Wrong number of arguments');
}
if (!process.env['VSCODE_GIT_ASKPASS_HANDLE']) {
return fatal('Missing handle');
}
if (!process.env['VSCODE_GIT_ASKPASS_PIPE']) {
return fatal('Missing pipe');
}
@@ -33,10 +29,9 @@ function main(argv: string[]): void {
}
const output = process.env['VSCODE_GIT_ASKPASS_PIPE'] as string;
const socketPath = process.env['VSCODE_GIT_ASKPASS_HANDLE'] as string;
const request = argv[2];
const host = argv[4].substring(1, argv[4].length - 2);
const ipcClient = new IPCClient('askpass', socketPath);
const ipcClient = new IPCClient('askpass');
ipcClient.call({ request, host }).then(res => {
fs.writeFileSync(output, res + '\n');