MCPcopy Create free account
hub / github.com/mscdex/ssh2 / exitStatus

Method exitStatus

lib/protocol/Protocol.js:1675–1698  ·  view source on GitHub ↗
(chan, status)

Source from the content-addressed store, hash-verified

1673 sendPacket(this, this._packetRW.write.finalize(packet));
1674 }
1675 exitStatus(chan, status) {
1676 if (!this._server)
1677 throw new Error('Server-only method called in client mode');
1678
1679 // Does not consume window space
1680 let p = this._packetRW.write.allocStart;
1681 const packet = this._packetRW.write.alloc(1 + 4 + 4 + 11 + 1 + 4);
1682
1683 packet[p] = MESSAGE.CHANNEL_REQUEST;
1684
1685 writeUInt32BE(packet, chan, ++p);
1686
1687 writeUInt32BE(packet, 11, p += 4);
1688 packet.utf8Write('exit-status', p += 4, 11);
1689
1690 packet[p += 11] = 0;
1691
1692 writeUInt32BE(packet, status, ++p);
1693
1694 this._debug && this._debug(
1695 `Outbound: Sending CHANNEL_REQUEST (r:${chan}, exit-status: ${status})`
1696 );
1697 sendPacket(this, this._packetRW.write.finalize(packet));
1698 }
1699 exitSignal(chan, name, coreDumped, msg) {
1700 if (!this._server)
1701 throw new Error('Server-only method called in client mode');

Callers 2

exitMethod · 0.80
test-sftp.jsFile · 0.80

Calls 3

writeUInt32BEFunction · 0.85
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected