-
By the way, if you'd tried using noskipws you should have found it worked. That's because Pstreams behaves the same as the standard streams.
2009-09-25 23:03:59 UTC in PStreams
-
Try replacing get_command_result with this:
void get_command_result(std::string const command, std::string& info)
{
std::string input;
std::istringstream query("a\nb\nc\n");
while (query >> input)
{
info += input;
}
}
Notice that there are newlines in the string. Notice that the output does not contain newlines.
That's how iostreams work, please read about...
2009-09-25 22:44:39 UTC in PStreams
-
Pstreams doesn't do any translation or anything else with the bytes transferred between processes, you can check the code to verify this yourself. If characters are being lost it is by the shell command you are running or by your own code.
Please provide a minimal testcase demonstrating the problem if you still think pstreams is responsible for this behaviour.
2009-09-25 12:16:53 UTC in PStreams
-
If execvp fails the process will call _exit(errno) ... what more do you want? Where would abort be helpful?
Calling exit(errno) would be incorrect as it would run destructors in the child process for objects that were created in the parent.
If you have any useful suggestions please propose patches and I will consider them, until then I'm closing this as invalid.
2009-09-23 21:46:26 UTC in PStreams
-
> I have just performed my own little code review.
So do you agree it's pointless to check the return value of execvp(3)? It will return -1 or it will not return, so checking it is stupid. What do you suggest I do if write(2) fails, when I am about to close the descriptors and exit anyway? If you want to be really strict you should check the result of close(2) as well, but again, there's...
2009-09-23 18:03:09 UTC in PStreams
-
redi committed patchset 310 of module pstreams to the PStreams CVS repository, changing 1 files.
2009-09-23 15:53:09 UTC in PStreams
-
redi committed patchset 309 of module pstreams to the PStreams CVS repository, changing 1 files.
2009-09-23 15:50:34 UTC in PStreams
-
> Which exceptions would you like to throw if functions fail for the process
> management?
Can you clarify your question?.
2009-09-23 15:43:38 UTC in PStreams
-
P.S. I am happy to change the code to e.g.
(void) ::execvp(file.c_str(), arg_v);
if that makes it clear that I am ignoring the return code intentionally.
Are you requesting this because you get compiler warnings with e.g. _FORTIFY_SOURCE ?.
2009-09-23 15:38:39 UTC in PStreams
-
Do you mean the calls to execvp and write in basic_pstreambuf::open() ?
There's no point checking the return value of execvp, if it returns then it failed, and I send errno to the parent. If the call to write fails there is nothing I can do, so I just close the descriptors and exit.
I will certainly add more error checking if it is worthwhile, but I don't think there is any point adding...
2009-09-23 15:35:47 UTC in PStreams