Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Sep 7, 2024
1 parent 9c63f82 commit 0fa04c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/crystal/system/win32/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ struct Crystal::System::Process
# Replaces the C standard streams' file descriptors, not Win32's, since
# `try_replace` uses the C `LibC._wexecvp` and only cares about the former
private def self.reopen_io(src_io : IO::FileDescriptor, dst_io : IO::FileDescriptor)
src_io = to_real_fd(src_io)

unless src_io.system_blocking?
raise IO::Error.new("Non-blocking streams are not supported in `Process.exec`", target: src_io)
end
Expand All @@ -388,6 +390,15 @@ struct Crystal::System::Process
end
end

private def self.to_real_fd(fd : IO::FileDescriptor)
case fd
when STDIN then ORIGINAL_STDIN
when STDOUT then ORIGINAL_STDOUT
when STDERR then ORIGINAL_STDERR
else fd
end
end

def self.chroot(path)
raise NotImplementedError.new("Process.chroot")
end
Expand Down

0 comments on commit 0fa04c6

Please sign in to comment.