<div dir="ltr"><div>Hello All,</div><div><br></div><div>I have an Test.cpp which is run under sandbox(RHEL7):<br></div><div><br></div><div>Test.cpp content:</div><div>#include&lt;stdio&gt;</div><div> int main(void) {</div><div>  int a = 1/0;</div><div>  return 0;</div><div> }</div><div><br></div><div>compile it using gcc(4.8) Test.cpp which produces the a.out</div><div>Now running a.out prints floating pointing exception on console</div><div><br></div><div>Now i thought that if i redirect stderr to a file, i expect the error to be printed in file.</div><div>But that is not the case it still continue to print in console.</div><div>Googling reveal that under such exception the program is terminated immediately and if you capture the stderr of bash then it should redirect.</div><div>So i run</div><div><i>su -c ./a.out 2&gt;err </i></div><div>Bingo error get printed in err file.</div><div><br></div><div>Now the MAIN GAME STARTS</div><div>i want to run it under sandbox </div><div>so i run:</div><div><i>su -c &#39;sandbox ./a.out 1&gt;out 2&gt;err&#39;</i></div><div>But there is nothing printed in err file or in console.</div><div><br></div><div>How to capture stdout and stderr under such situation ?</div><div><br></div><div><br></div><div>Thanks</div><div>Bhuvan</div></div>