After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147256 - piping terminal command output to gedit doesnot work
piping terminal command output to gedit doesnot work
Status: RESOLVED DUPLICATE of bug 121891
Product: gedit
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2004-07-10 09:41 UTC by Muktha
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.64 KB, patch)
2004-07-10 09:52 UTC, Muktha
none Details | Review

Description Muktha 2004-07-10 09:41:23 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.
Comment 1 Muktha 2004-07-10 09:52:26 UTC
Created attachment 29402 [details] [review]
Proposed patch
Comment 2 Paolo Borelli 2004-07-10 10:04:33 UTC
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.
Comment 3 Paolo Maggi 2004-07-12 15:20:18 UTC
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.

Comment 4 Paolo Maggi 2004-07-13 12:04:58 UTC

*** This bug has been marked as a duplicate of 121891 ***