Skip to content

Commit

Permalink
rename Process.getpgid to Process.pgid, add argumentless version
Browse files Browse the repository at this point in the history
  • Loading branch information
jhass committed May 28, 2016
1 parent 0804a8f commit a5b2f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spec/std/process_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ describe Process do

it "gets the pgid of a process id" do
process = fork { loop { } }
Process.getpgid(process.pid).should be_a(Int32)
Process.pgid(process.pid).should be_a(Int32)
process.kill(Signal::KILL)
Process.pgid.should eq(Process.pgid(Process.pid))
end

it "can link processes together" do
Expand Down
6 changes: 5 additions & 1 deletion src/process/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ class Process
LibC.getpid
end

def self.getpgid(pid : Int32) : LibC::PidT
def self.pgid : LibC::PidT
pgid(0)
end

def self.pgid(pid : Int32) : LibC::PidT
ret = LibC.getpgid(pid)
raise Errno.new(ret) if ret < 0
ret
Expand Down

0 comments on commit a5b2f4e

Please sign in to comment.