30 March 2007

partimage + stdout, existing code

On first inspection it looks like some code already exists for writing an image to stdout (standard output).

image_disk.cpp, line 558
  if (strcmp(m_szImageFilename, "stdout"))
{
//... network output code hidden for clarity ...
}
else // it's stdout
{
m_fImageFile = stdout;
showDebug(1, "image will be on stdout\n");
}

Unlike stdin for restore, stdout for save is not currently available in the command line options. I did do a build earlier where I enabled it (which I don't have any more due to my build problems). I managed to pipe an image to hexdump and seemed to be able to see some of the user interface info in the output.

It would seem the problem with the stdout option is that even in batch mode the program outputs interface data to stdout, which then corrupts the image.

I think I shall attempt to remove all the UI stuff, and make it act more like all the other unix tools. Might also try to create a reusable library out of it.

3 comments:

Brian said...

Is this working in the latest partimage?

Anonymous said...

yes. what is the status on this?

Tim Abell said...

I'm afraid I haven't had occasion to use partimage for a long time now, so someone else will have to answer this question.