partimage + stdout, existing code

March 30, 2007

0 minute read

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.


Share as Tweet || Share on LinkedIn
Post source code on GitHub - suggestions & PRs welcome!
Subscribe for updates on software development, contracting, side projects, blog posts and who knows what else. Read the archives for an idea of content.

Mailing list powered by the excellent buttondown.email.