This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
/** @babel */
2
2
import net from 'net'
3
3
import path from 'path'
4
+ import os from 'os'
4
5
5
6
import Prompt from './views/prompt'
6
7
import { deleteFolder , getTempDir } from './helpers'
@@ -37,12 +38,13 @@ function getInputViaPrompt (query) {
37
38
export default class GitPromptServer {
38
39
async start ( promptForInput = getInputViaPrompt ) {
39
40
// TODO: [mkt] Windows?? yes.
40
- const windows = process . platform === 'win32'
41
41
this . promptForInput = promptForInput
42
- this . tmpFolderPath = await getTempDir ( windows ? 'C:\Windows\Temp' : '/tmp/github-git-prompt-server-' )
42
+ const windows = process . platform === 'win32'
43
+ const prefix = windows ? os . tmpdir ( ) : '/tmp'
44
+ this . tmpFolderPath = await getTempDir ( path . join ( prefix , 'github' ) )
43
45
const socketPath = path . join ( this . tmpFolderPath , 'helper.sock' )
44
46
const namedPipePath = path . join ( '\\\\?\\pipe\\' , 'gh-' + require ( "crypto" ) . randomBytes ( 8 ) . toString ( 'hex' ) , 'helper.sock' )
45
- this . server = await this . startListening ( socketPath )
47
+ this . server = await this . startListening ( windows ? namedPipePath : socketPath )
46
48
47
49
return {
48
50
socket : windows ? namedPipePath : socketPath ,
You can’t perform that action at this time.
0 commit comments