[yast-commit] r55756 - in /branches/tmp/lslezak/core: ./ agent-any/doc/ agent-dummy/doc/ agent-ini/doc/ agent-modules/doc/ agent-process/doc/ agent-resolver/doc/ agents-perl/doc/ base/tools/tty_wrapper/ dbus/SCR...
Author: lslezak Date: Wed Feb 25 17:54:58 2009 New Revision: 55756 URL: http://svn.opensuse.org/viewcvs/yast?rev=55756&view=rev Log: - merged changes from trunk (rev. 55755) Modified: branches/tmp/lslezak/core/ (props changed) branches/tmp/lslezak/core/agent-any/doc/ag_anyagent.html (props changed) branches/tmp/lslezak/core/agent-dummy/doc/ag_dummy.html (props changed) branches/tmp/lslezak/core/agent-ini/doc/ag_ini.html (props changed) branches/tmp/lslezak/core/agent-modules/doc/ag_modules.html (props changed) branches/tmp/lslezak/core/agent-process/doc/ag_process.html (props changed) branches/tmp/lslezak/core/agent-resolver/doc/ag_resolver.html (props changed) branches/tmp/lslezak/core/agents-perl/doc/ag_modinfo.html (props changed) branches/tmp/lslezak/core/agents-perl/doc/ag_yp_makefile.html (props changed) branches/tmp/lslezak/core/base/tools/tty_wrapper/tty_wrapper.cc branches/tmp/lslezak/core/dbus/SCR_service/ (props changed) branches/tmp/lslezak/core/dbus/namespace_service/Yast_dbus_server.cc (props changed) branches/tmp/lslezak/core/dbus/namespace_service/org.opensuse.YaST.modules.conf.in (props changed) branches/tmp/lslezak/core/dbus/namespace_service/org.opensuse.YaST.modules.service.in.in (props changed) branches/tmp/lslezak/core/liby2dbus/ (props changed) branches/tmp/lslezak/core/package/yast2-core.changes Modified: branches/tmp/lslezak/core/base/tools/tty_wrapper/tty_wrapper.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/base/tools/tty_wrapper/tty_wrapper.cc?rev=55756&r1=55755&r2=55756&view=diff ============================================================================== --- branches/tmp/lslezak/core/base/tools/tty_wrapper/tty_wrapper.cc (original) +++ branches/tmp/lslezak/core/base/tools/tty_wrapper/tty_wrapper.cc Wed Feb 25 17:54:58 2009 @@ -74,6 +74,32 @@ return true; } +void output(const std::string & s, int fd) +{ + const char *cs = s.c_str(); + while (true) { + ssize_t n = s.size(); + ssize_t w = write(fd, cs, n); + if (w == n) + break; // success + else if (w == -1) { + if (errno == EINTR) { + // perror("gotcha"); // bnc#470645 + } + else { + perror("write"); // other cases + break; + } + } + else { + errno = 0; + perror("short"); + cs += w; + n -= w; + } + } +} + int main(int argc, char **argv) { if (argc > 1) @@ -119,6 +145,11 @@ if (finish) { + // read the remaining pieces + std::string std_out(subprocess.read()); + output(std_out, 1); + std::string err_out(subprocess.readErr()); + output(err_out, 2); // SIGCHLD received, return the exit status return subprocess.close(); } @@ -168,7 +199,7 @@ { // read stdout of the subprocess and print it on stdout std::string std_out(subprocess.read()); - std::cout << std_out; + output(std_out, 1); } // stderr available @@ -176,7 +207,7 @@ { // read stderr of the subprocess and print it on stderr std::string err_out(subprocess.readErr()); - std::cerr << err_out; + output(err_out, 2); } } } @@ -189,4 +220,3 @@ return 1; } } - Modified: branches/tmp/lslezak/core/package/yast2-core.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/package/yast2-core.changes?rev=55756&r1=55755&r2=55756&view=diff ============================================================================== --- branches/tmp/lslezak/core/package/yast2-core.changes (original) +++ branches/tmp/lslezak/core/package/yast2-core.changes Wed Feb 25 17:54:58 2009 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Wed Feb 25 14:49:33 CET 2009 - mvidner@suse.cz + +- Fixed tty_wrapper losing output: stdio was interrupted by SIGCHLD (bnc#470645). + +------------------------------------------------------------------- Thu Jan 29 15:15:57 CET 2009 - aschnell@suse.de - added dbus client agent (required for bnc #464453) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org