Skip to content
Draft
Prev Previous commit
Next Next commit
Update Sources/System/Process/Signal.swift
Co-authored-by: Karoy Lorentey <[email protected]>
  • Loading branch information
milseman and lorentey authored Feb 25, 2021
commit a051d71ae486b90c203c78a86d96b233fc827076
2 changes: 1 addition & 1 deletion Sources/System/Process/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension Signal {
public static var segmentationViolation: Signal { Signal(SIGSEGV) }

/// SIGSYS (12): non-existent system call invoked (default behavior: create core image)
public static var badSyscall: Signal { Signal(SIGSYS) }
public static var unknownSystemCall: Signal { Signal(SIGSYS) }

/// SIGPIPE (13): write on a pipe with no reader (default behavior: terminate process)
public static var pipe: Signal { Signal(SIGPIPE) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static var pipe: Signal { Signal(SIGPIPE) }
public static var brokenPipe: Signal { Signal(SIGPIPE) }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, you can also get them on sockets...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's interesting. 🤔

Broken pipe is what psignal prints on SIGPIPE, which is why I suggested it. It has the advantage that it evokes the original name but also tries to clarify it a little.

Should we use that, use pipe, or should we try to find a more exact term?

Copy link
Member

@lorentey lorentey Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we imported EPIPE as Errno.brokenPipe. I think we should probably use the same name here -- especially since it looks like the error is returned in the exact same situations as when the signal is sent.

[EPIPE]
Broken pipe. A write was attempted on a socket, pipe, or FIFO for which there is no process to read the data.

Expand Down