sigpipe

Preventing SIGPIPE

余生颓废 提交于 2019-12-23 16:23:26
问题 Let's consider the following example. I have a parent process that creates a pipe, spawns a child and read the child's standard output using this pipe. At some point, the parent process is no longer interested in the child's output, and closes the read end of the pipe. Apparently, if the child keeps writing, will this result in the child process receiving a SIGPIPE signal. Question: is there a way to redirect the child's output to /dev/null so that it still keeps running and producing output,

Ignoring Bash pipefail for error code 141

邮差的信 提交于 2019-12-22 03:59:28
问题 Setting the bash pipefail option (via set -o pipefail ) allows the script to fail if a non-zero error is caught where there is a non-zero error in any step of a pipe. However, we are running into SIGPIPE errors (error code 141), where data is written to a pipe that no longer exists. Is there a way to set bash to ignore SIGPIPE errors, or is there an approach to writing an error handler that will handle all error status codes but, say, 0 and 141? For instance, in Python, we can add: signal

TCP client-server SIGPIPE

拥有回忆 提交于 2019-12-19 21:49:57
问题 I am designing and testing a client server program based on TCP sockets(Internet domain). Currently , I am testing it on my local machine and not able to understand the following about SIGPIPE. *. SIGPIPE appears quite randomly. Can it be deterministic? The first tests involved single small(25 characters) send operation from client and corresponding receive at server. The same code, on the same machine runs successfully or not(SIGPIPE) totally out of my control. The failure rate is about 45%

SIGPIPE crash when switching background task

北城以北 提交于 2019-12-07 09:56:56
问题 I'm experiencing a weird crash when sending my app into the background, loading a new app, switching the device into sleep mode, waking up the device, closing the new app and then opening my app from the background tasks. A black screen will appear and I cannot exit this black screen with the home button, and in the debugger I am shown this message: Program received signal: “SIGPIPE”. Data Formatters unavailable (Error calling dlopen for: "/Developer/usr/lib/libXcodeDebuggerSupport.dylib":

Python subprocess.Popen PIPE and SIGPIPE

末鹿安然 提交于 2019-12-06 08:02:48
问题 While I browsed posts, I ran into this example below on here, It is saying proc1.stdout.close() is needed to be called for appropriate exit of proc1 , generating SIGPIPE . import subprocess proc1 = subprocess.Popen(['ps', 'cax'], stdout=subprocess.PIPE) proc2 = subprocess.Popen(['grep', 'python'], stdin=proc1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc1.stdout.close() # Allow proc1 to receive a SIGPIPE if proc2 exits. out, err = proc2.communicate() print('out: {0}'.format(out

Ignoring Bash pipefail for error code 141

你说的曾经没有我的故事 提交于 2019-12-05 01:44:18
Setting the bash pipefail option (via set -o pipefail ) allows the script to fail if a non-zero error is caught where there is a non-zero error in any step of a pipe. However, we are running into SIGPIPE errors (error code 141), where data is written to a pipe that no longer exists. Is there a way to set bash to ignore SIGPIPE errors, or is there an approach to writing an error handler that will handle all error status codes but, say, 0 and 141? For instance, in Python, we can add: signal.signal(signal.SIGPIPE, signal.SIG_DFL) to apply the default behavior to SIGPIPE errors: ignoring them (cf.

SIGPIPE error in iOS4 when app is running background and lock screen

拜拜、爱过 提交于 2019-12-04 14:38:43
问题 I use BSD socket in my app to send and receive data on iphone4(iOS4.1),there are three situations in my app: app is running in foreground and screen locks, it's fine. app is running in background and screen does't lock, it's fine too(I use NSStream to send and receive data for keep app alive in background,it works fine.) app is running in background and screen locks, app running fine but always get the SIGPIPE error when app try to call sendto() or send() through UDP or TCP socket. I search a