tags:

views:

181

answers:

3

Hi,

I have a problem while executing a bash script from C++ using the system call command. The script catch a SIGPIPE signal and exit with ret code 141.

This problem has started to appear only in the last release of my code. My Questions are as follows:

1) Why does this SIGPIPE occur now and didn't occur before? 2) Is it safe to ignore the SIGPIPE and what are the consequences?

Thanks, Eyal

+2  A: 

1) That's very hard to answer without knowing exactly what you changed.
2) If a sequence of commands appears in a pipeline, and one of the reading commands finishes before the writer has finished, the writer receives a SIGPIPE signal. So whether you can ignore it depends on whether that is acceptable behavior for your script. More info here

PiedPiper
+2  A: 

A current version of the FAQ that PiedPiper linked to states:

As of bash-3.1, bash does not report SIGPIPE errors by default. You can build a version of bash that will report such errors.

Is it possible that you changed Bash versions or the way it's built and that caused the change in behavior in your code?

Dennis Williamson