strange behaviour of procmail when piping content to c++ executable

I have a working procmail config.
this is the rc.filters :

1
2
3
:0 w :a.lock
* ^From:(.*\<)?(try@gmail\.com)\>
| $HOME/executable/a.out

this file compiles and works, procmail delivers the mail, and the executable writes the content to the output file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdlib.h>
#include <iostream>
#include <fstream>

using namespace std;

int main(void)
{
ofstream myfile;
myfile.open ("output.txt");

    string line;
    while (getline(cin, line)) 
    {
    myfile << line << endl;     
    }
    
myfile.close();    
return EXIT_SUCCESS;
} 

the problem is I need a cin object with the content to pass to a constructor of the Mimetic library. I need this executable to work:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <mimetic/mimetic.h>

using namespace std;
using namespace mimetic;

int main(void)
{
  ofstream myfile;
  myfile.open ("output.txt");

  MimeEntity me(cin);                         
  const Header& h = me.header();  
  string subjectString = h.subject();
  myfile << subjectString;
  myfile << "Check";      
  myfile.close();
  return EXIT_SUCCESS;
}

If I take a Mime message called message.txt and do the following with the second code :

cat message.txt | ./a.out

./a.out < message.txt

In both cases the executable works and I get the subject in an output.txt
but for some when it is invoked and the content piped by procmail it doesn't work,
and all I get in the output.txt is "Check" which means that the file was at least invoked.

the procmail.log states that everything is fine.
Topic archived. No new replies allowed.