Skip to content

Quiet mode does not work on windows when matplot is called from a GUI application #376

@geral-victor

Description

@geral-victor

Bug category

  • bug - compilation error
  • bug - compilation warning
  • bug - runtime error
  • bug - runtime warning
  • bug - logic error

Describe the bug
When creating a figure from a GUI app on windows, in order to generate quietly a plot and save the resulting output as an image, a terminal gets opened.

The problem does not exists if we run the library in a console program.

Steps to Reproduce

{
   auto f = matplot::figure(true); //opens a terminal that is visible, despite having chosen quiet mode.
   ...
   f->save(filename);
}

Dirty fix

{
   auto f = matplot::figure(true); //opens a terminal that is visible, despite having chosen quiet mode.
   ...
   f->save(filename);
   f->backend({}); // dirty patch to close the console opened when matplot++ is called from a GUI, and not a console
}

Platform

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: Windows 10

Is seems that the issue is related to the use of _popen :

pipe_ = POPEN("gnuplot", "w");

It seems that _popen cannot hide windows, as we can read here https://stackoverflow.com/a/10020726/18371648

So we should use CreateProcess instead of _popen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions