GNOME Bugzilla – Bug 147256
piping terminal command output to gedit doesnot work
Last modified: 2004-12-22 21:47:04 UTC
In gedit_file_open_from_stdin(), fstat is used to check if there is any input from stdin. If there's no input (ie, st_size is zero), further processing is not done. On Linux, st_size member from fstat() is zero and hence the output is not displayed. The problem can be simulated by executing pwd | gedit It can be seen that though gedit opens successfully, the output of 'pwd' is not displayed.
Created attachment 29402 [details] [review] Proposed patch
this is actually a duplicate of 121891, but since you are attaching a patch I'll wait to mark it as such... (if you want to close it and attach the patch there, feel free to do it). I haven't looked at the patch accurately yet, but I remember I also had a patch that fixed it on my system, but when I discussed it with Paolo M. we agreed that was more of a workarond than a fix. In particular note the ugly hack now present in stdin: /* wait for 1/4 of a second */ tv.tv_sec = 0; tv.tv_usec = STDIN_DELAY_MICROSECONDS; if (select (1, &rfds, NULL, NULL, &tv) != 1) return NULL; One possible way to properly fix all this code is to use g_io_channels to integrate nicely the stdin read with gtk main loop.
Muktha: please, reattach your patch to bug #121891. BTW, as Paolo Borelli suggested, your patch does not seem to solve the problem in all the cases. We really need to try a way to nicely integrate stdin read with gtk main loop.
*** This bug has been marked as a duplicate of 121891 ***