21

... something similar to /dev/null, but that just blocks all bytes that are written to it?

What I need is a trick to hold an arbitrary executable in memory by blocking its output. Pipes don't seem to be usable, because the output gets written to a buffer first.

27

You can create a named pipe (fifo) using mkfifo. Writes to this type of special file will block until a process reads from it.

$ mkfifo blocker
$ echo hello > blocker # "hangs"

In another session:

$ cat blocker
hello                  # the `echo` above unblocks after this

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.