| 102 | } |
| 103 | |
| 104 | async updatePipPython() { |
| 105 | console.log('Updating pip'); |
| 106 | const pythonPath = this.SurferPythonPath; |
| 107 | console.log('Python path update', pythonPath); |
| 108 | |
| 109 | if (process.platform === 'win32') { |
| 110 | const pipUpgradeProcess = spawn( |
| 111 | pythonPath, |
| 112 | ['python.exe', '-m', 'pip', 'install', '--upgrade', 'pip'], |
| 113 | { |
| 114 | shell: true, |
| 115 | }, |
| 116 | ); |
| 117 | |
| 118 | pipUpgradeProcess.stdout.on('data', (data) => { |
| 119 | console.log(`stdout: ${data}`); |
| 120 | }); |
| 121 | |
| 122 | pipUpgradeProcess.stderr.on('data', (data) => { |
| 123 | console.error(`stderr: ${data}`); |
| 124 | }); |
| 125 | } else { |
| 126 | const { stdout, stderr } = await execAsync( |
| 127 | `${pythonPath} -m pip install --upgrade pip`, |
| 128 | ); |
| 129 | |
| 130 | console.log('stdout:', stdout); |
| 131 | console.log('stderr:', stderr); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | async runCommand(command: string) { |
| 136 | const { stdout, stderr } = await execAsync(command); |