diff --git a/lib/Sidef/Sys/Sys.pm b/lib/Sidef/Sys/Sys.pm index 7a0f03ba6..a24faf91f 100644 --- a/lib/Sidef/Sys/Sys.pm +++ b/lib/Sidef/Sys/Sys.pm @@ -13,6 +13,16 @@ package Sidef::Sys::Sys { exit($code // 0); } + sub wait { + my ($self) = @_; + Sidef::Types::Number::Number->new(CORE::wait); + } + + sub fork { + my ($self) = @_; + Sidef::Types::Number::Number->new(fork() // return); + } + sub alarm { my ($self, $sec) = @_; diff --git a/lib/Sidef/Types/Glob/FileHandle.pm b/lib/Sidef/Types/Glob/FileHandle.pm index 9fc6ec527..796f3b44a 100644 --- a/lib/Sidef/Types/Glob/FileHandle.pm +++ b/lib/Sidef/Types/Glob/FileHandle.pm @@ -53,12 +53,12 @@ package Sidef::Types::Glob::FileHandle { CORE::binmode($self->{fh}, $encoding->get_value); } - sub write_string { + sub syswrite { my ($self, @args) = @_; - Sidef::Types::Bool::Bool->new(syswrite $self->{fh}, @args); + Sidef::Types::Bool::Bool->new(CORE::syswrite $self->{fh}, @args); } - *syswrite = \&write_string; + *write_string = \&syswrite; sub print { my ($self, @args) = @_; diff --git a/lib/Sidef/Types/Glob/Socket.pm b/lib/Sidef/Types/Glob/Socket.pm index 64267beaf..6ad987bb4 100644 --- a/lib/Sidef/Types/Glob/Socket.pm +++ b/lib/Sidef/Types/Glob/Socket.pm @@ -39,6 +39,15 @@ package Sidef::Types::Glob::Socket { Sidef::Types::Glob::SocketHandle->new(fh => $fh); } + sub socketpair { + my ($self, $socket1, $socket2, $domain, $type, $protocol) = @_; + CORE::socketpair(my $sh1, my $sh2, $domain->get_value, $type->get_value, $protocol->get_value) + || return Sidef::Types::Bool::Bool->false; + $socket1->get_var->set_value(Sidef::Types::Glob::SocketHandle->new(fh => $sh1)); + $socket2->get_var->set_value(Sidef::Types::Glob::SocketHandle->new(fh => $sh2)); + Sidef::Types::Bool::Bool->true; + } + # ## gethost* #