Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 6d50392

Browse files
committed
Kill the askpass and credential helper processes separately
1 parent 228a80f commit 6d50392

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

bin/git-askpass-atom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function userHelper() {
4343
}
4444

4545
function dialog() {
46-
const payload = {prompt, includeUsername: false};
46+
const payload = {prompt, includeUsername: false, pid: process.pid};
4747
log('requesting dialog through Atom socket');
4848
log(`prompt = "${prompt}"`);
4949

bin/git-credential-atom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function dialog(query) {
182182
const prompt = 'Please enter your credentials for ' + url.format(query);
183183
const includeUsername = !query.username;
184184

185-
const payload = {prompt, includeUsername};
185+
const payload = {prompt, includeUsername, pid: process.pid};
186186

187187
return new Promise((resolve, reject) => {
188188
log('requesting dialog through Atom socket');

lib/git-prompt-server.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import net from 'net';
22
import path from 'path';
3+
import treeKill from 'tree-kill';
34

45
import {Emitter} from 'event-kit';
56

@@ -92,7 +93,12 @@ export default class GitPromptServer {
9293

9394
Promise.resolve(this.promptForInput(query))
9495
.then(answer => connection.end(JSON.stringify(answer), 'utf-8'))
95-
.catch(() => this.emitter.emit('did-cancel'));
96+
.catch(() => {
97+
this.emitter.emit('did-cancel');
98+
if (query.pid) {
99+
treeKill(query.pid);
100+
}
101+
});
96102
}
97103

98104
onDidCancel(cb) {

0 commit comments

Comments
 (0)