(command: string, args: Array<string>, data: string, options?: SpawnOptions)
| 182 | } |
| 183 | |
| 184 | export function spawnAndWrite(command: string, args: Array<string>, data: string, options?: SpawnOptions) { |
| 185 | const childProcess = doSpawn(command, args, options, {isPipeInput: true}) |
| 186 | const timeout = setTimeout(() => childProcess.kill(), 4 * 60 * 1000) |
| 187 | return new Promise<any>((resolve, reject) => { |
| 188 | handleProcess("close", childProcess, command, () => { |
| 189 | try { |
| 190 | clearTimeout(timeout) |
| 191 | } |
| 192 | finally { |
| 193 | resolve() |
| 194 | } |
| 195 | }, error => { |
| 196 | try { |
| 197 | clearTimeout(timeout) |
| 198 | } |
| 199 | finally { |
| 200 | reject(error.stack || error.toString()) |
| 201 | } |
| 202 | }) |
| 203 | |
| 204 | childProcess.stdin.end(data) |
| 205 | }) |
| 206 | } |
| 207 | |
| 208 | export function spawn(command: string, args?: Array<string> | null, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> { |
| 209 | return new Promise<any>((resolve, reject) => { |
no test coverage detected
searching dependent graphs…