natcap / invest-workbench

An Electron application front-end for InVEST
Other
1 stars 5 forks source link

Windows: invest runs popup in a new cmd shell #47

Closed davemfish closed 4 years ago

davemfish commented 4 years ago

After setting up a run and clicking 'Execute', instead of switching to the workbench's Log tab display, Windows opens a new cmd window and invest runs there.

Probably we need to have a Windows-specific child_process call for launching invest to match the behavior we get with spawn on mac & linux.

phargogh commented 4 years ago

Hey @davemfish I see you're already working on this, but it sounds like the pyinstaller build on this might be related. On Windows, we have to specify a binary application as either a command-line application (where a CMD shell will show up, which is how InVEST is currently built), or a GUI application, where the application's stdout is not attached to a shell at all (and it's presumed that the application is reporting its logging somewhere appropriate). I coincidentally created https://github.com/natcap/invest/issues/325 for the Qt application's logging just this morning, but also since you're doing a separate build for the workbench, I wonder if this might include flipping the CLI/GUI application switch in the pyinstaller specfile?

davemfish commented 4 years ago

Hmm I don't fully understand the logging issue, but putting that aside I'd certainly like to try what you're suggesting. I tried the --windowed flag when running PyInstaller, but did not observe any change. Is there another "switch" you know of in the spec file?

One thing that is puzzling: the invest cli binary and the flask launcher binary are both created by Pyinstaller. The flask app is launched by node like this and works on all OS:

spawn(path.basename(serverExe), {
    env: { PATH: path.dirname(serverExe) },
});
davemfish commented 4 years ago

Okay, I think I'm making progress on this without getting into the PyInstaller stuff.

phargogh commented 4 years ago

Great! Yes, the --windowed flag was what I was thinking of, and strange that building the application with and without --windowed has the same effect. I'm glad that this isn't ultimately an issue with pyinstaller.