Egrep Write Error Broken Pipe
Contents |
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and cat write error broken pipe policies of this site About Us Learn more about Stack Overflow the company
Ls Write Error Broken Pipe
Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask ls write error broken pipe python Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask echo write error broken pipe a question Anybody can answer The best answers are voted up and rise to the top gnome-terminal starts with “grep: write error: Broken pipe” message up vote 3 down vote favorite I am running Ubuntu 14.04.3, it's uptodate. I don't know why, for a few days I began to take grep: write error: Broken pipe message on launching gnome-terminal . It seems to be
Write Error Broken Pipe Android
harmless but it bothers me. How can I debug it? EDIT: I moved aliases and functions each to separate files such as .bash_aliases and .bash_functions and added a command to load them from .bashrc if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi if [ -f ~/.bash_functions ]; then . ~/.bash_functions fi If I don't load .bash_functions problem disappears. I am trying to find the faulty one by disabling each function one by one. This one gives me the same error but when I disable it I keep getting the same error, so I may have more faulty functions. ls -lt $PWD| grep ^d | head -1 | cut -b 51- grep: development write error: Broken pipe I wonder why I begin to take that error. EDIT2: I found a similar problem here boken pipe The root of the problem also seems similar. I tried the given test command in the link which have the same error: bash -c '(while echo foo; do :; done); echo status=$? >&2' | head foo foo foo foo foo foo foo foo foo foo bash: line 0: echo: write error: Broken pipe
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business socketclient write error broken pipe Learn more about hiring developers or posting ads with us Super User Questions Tags Users grep writing output broken pipe Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only
Grep Write Error On Login
takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Is there a way around broken pipe? up vote 2 http://askubuntu.com/questions/733484/gnome-terminal-starts-with-grep-write-error-broken-pipe-message down vote favorite I have a directory with a large number of files. ./I_am_a_dir_with_many_subdirs/ Within a script I'd like to find all subdirs in it, to sort them and to output to a bash array. So, I do: SubdirsArray=(`find ./I_am_a_dir_with_many_subdirs/ -maxdepth 2 -mindepth 2 -type d | sort`) Executing the script, I get the following error messages: sort: write failed: standard output: Broken pipe sort: write error As explained in this post: probably sort executes and http://superuser.com/questions/728897/is-there-a-way-around-broken-pipe closes the pipe, before find completes writing to it. Thus write() command initiated by find gets an error EPIPE "Broken pipe", OS sends find a SIGPIPE. Before the SIGPIPE reaches find, it prints the error message, then gets SIGPIPE and dies. Questions: So, what does my SubdirsArray contain? The Subdirs, that find found, but sort left unsorted? If so, than what would be the way around this issue with broken pipes? Make find write it's results to a temporary file and then make sort read it? I don't understand, why "it's also nothing to be concerned about" if it happens within a non-interactive shell: why? My SubdirsArray contains something unsorted and further in the script, I assume, that its elements are sorted?! I get two error messages: sort: write failed: standard output: Broken pipe sort: write error In this thread it is suggested, that sort doesn't have enough space in a temporary directory to sort all the input. But, doesn't it mean, that sort got something from find?!? I'm confused... Anyways, I tried to use SubdirsArray=(`find ./I_am_a_dir_with_many_subdirs/ -maxdepth 2 -mindepth 2 -type d | sort -T /home/temp_dir`) but it didn't help. P.S. I'm not sure whether it's important, but I use find|sort in a multi-processor script: several processors execute the same command at once in the subshells. linux bash shell sorting pipe share|improve this question edited
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/4106565/newbie-python-subprocess-write-error-broken-pipe the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow http://unix.stackexchange.com/questions/84813/what-makes-a-unix-process-die-with-broken-pipe Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each write error other. Join them; it only takes a minute: Sign up newbie python subprocess: “write error: Broken pipe” up vote 9 down vote favorite 6 Thanks to the helpful suggestions below: So it seems to be fixed when I separate commands into individual calls to Popen stderr=subprocess.PIPE as an argument to each Popen chain. The New code: import subprocess write error broken import shlex import logging def run_shell_commands(cmds): """ Run commands and return output from last call to subprocess.Popen. For usage see the test below. """ # split the commands cmds = cmds.split("|") cmds = list(map(shlex.split,cmds)) logging.info('%s' % (cmds,)) # run the commands stdout_old = None stderr_old = None p = [] for cmd in cmds: logging.info('%s' % (cmd,)) p.append(subprocess.Popen(cmd,stdin=stdout_old,stdout=subprocess.PIPE,stderr=subprocess.PIPE)) stdout_old = p[-1].stdout stderr_old = p[-1].stderr return p[-1] pattern = '"^85567 "' file = "j" cmd1 = 'grep %s %s | sort -g -k3 | head -10 | cut -d" " -f2,3' % (pattern, file) p = run_shell_commands(cmd1) out = p.communicate() print(out) Original Post: I've spent too long trying to solve a problem piping a simple subprocess.Popen. Code: import subprocess cmd = 'cat file | sort -g -k3 | head -20 | cut -f2,3' % (pattern,file) p = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) for line in p.stdout: print(line.decode().strip()) Output for file ~1000 lines in length: ... sort: write failed: standard output: Broken pipe sort: write error Output for file >241 lines in length: ... sort: fflush failed: standard
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top What makes a Unix process die with Broken pipe? up vote 14 down vote favorite 2 Here are some options I thought of, not sure which is the right one. There was an I/O error reading from the pipe. The process writing to the other end of the pipe died with a failure. All processes who could write to the pipe have closed it. The write buffer of the pipe is full. The peer has closed the other direction of the duplex pipe. Writing failed because there are no processes which could read from the pipe. A system call returned the EPIPE error, and there was no error handler installed. pipe share|improve this question edited Jan 18 at 10:44 muru 18k33165 asked Jul 29 '13 at 15:11 siamii 217126 What's your question? Are you asking which of those is correct, or if there are any other things that can cause the broken pipe? –EightBitTony Jul 29 '13 at 15:15 @EightBitTony Which of these is correct –siamii Jul 29 '13 at 15:16 add a comment| 3 Answers 3 active oldest votes up vote 23 down vote A process receives a SIGPIPE when it attempts to write to a pipe (named or not) or socket of type SOCK_STREAM that has no reader left. It's generally wanted behaviour. A typical example is: find . | head -n 1 You don't want find to keep on running once head has terminated (and then closed the only file descriptor open for reading on that pipe). The yes command typically relies on that signal to terminate. yes | some-command Will write "y" until some-command terminates. Note that it's not only when commands exit, it's when all the reader have closed their reading fd to the pipe. In: yes | ( sleep 1; exec <&-; ps -fC yes) 1 2 1 0 Their will be 1 (the subshell), then 2 (subshell + sleep), then