(err, container)
| 1568 | var hub = new EventEmitter(); |
| 1569 | |
| 1570 | function handler(err, container) { |
| 1571 | if (err) return callback(err, null, container); |
| 1572 | |
| 1573 | hub.emit('container', container); |
| 1574 | |
| 1575 | container.attach({ |
| 1576 | stream: true, |
| 1577 | stdout: true, |
| 1578 | stderr: true |
| 1579 | }, function handler(err, stream) { |
| 1580 | if (err) return callback(err, null, container); |
| 1581 | |
| 1582 | hub.emit('stream', stream); |
| 1583 | |
| 1584 | if (streamo) { |
| 1585 | if (streamo instanceof Array) { |
| 1586 | stream.on('end', function() { |
| 1587 | try { |
| 1588 | streamo[0].end(); |
| 1589 | } catch (e) {} |
| 1590 | try { |
| 1591 | streamo[1].end(); |
| 1592 | } catch (e) {} |
| 1593 | }); |
| 1594 | container.modem.demuxStream(stream, streamo[0], streamo[1]); |
| 1595 | } else { |
| 1596 | stream.setEncoding('utf8'); |
| 1597 | stream.pipe(streamo, { |
| 1598 | end: true |
| 1599 | }); |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | container.start(startOptions, function(err, data) { |
| 1604 | if (err) return callback(err, data, container); |
| 1605 | hub.emit('start', container); |
| 1606 | |
| 1607 | container.wait(function(err, data) { |
| 1608 | hub.emit('data', data); |
| 1609 | callback(err, data, container); |
| 1610 | }); |
| 1611 | }); |
| 1612 | }); |
| 1613 | } |
| 1614 | |
| 1615 | var optsc = { |
| 1616 | 'Hostname': '', |
no outgoing calls
no test coverage detected
searching dependent graphs…