Skip to content

Commit

Permalink
Return the PID as handle in posix
Browse files Browse the repository at this point in the history
Fixes some TypeError exceptions when attempting most operations on
spawned processes, e.g.:

  p = client.sys.process.execute("/bin/sh", nil, "Channelized"=>true)
  p.close
  # raises TypeError: can't convert nil into Integer

[FIXRM rapid7#7005]
  • Loading branch information
egypt committed Aug 8, 2012
1 parent b4b860f commit c19102c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ DWORD request_sys_process_execute(Remote *remote, Packet *packet)
default:
dprintf("child pid is %d\n", pid);
packet_add_tlv_uint(response, TLV_TYPE_PID,(DWORD)pid);
packet_add_tlv_uint(response, TLV_TYPE_PROCESS_HANDLE,(DWORD)pid);
if (flags & PROCESS_EXECUTE_FLAG_CHANNELIZED) {
if(have_pty) {
dprintf("child channelized\n");
Expand Down Expand Up @@ -1005,7 +1006,6 @@ DWORD process_channel_read(Channel *channel, Packet *request,
if((*bytesRead = read(ctx->pStdout, buffer, bufferSize) < 0)) {
result = GetLastError();
}

#endif
return result;
}
Expand Down

0 comments on commit c19102c

Please sign in to comment.