Error handling in ProcessHelper #289

Open
opened 2026-01-29 16:35:49 +00:00 by claunia · 0 comments
Owner

Originally created by @paralaxsd on GitHub (Mar 12, 2019).

Originally assigned to: @GregorBiswanger on GitHub.

Hi,

While trying to electronize an asp.net core angular application I found a limitation in the way "electronize start" works that prevents the process from finishing successfully:

Running electronize start in my web application directory bails with "Error occurred during dotnet publish: 1"

The reason for this became clear once I looked at ElectronNET.CLI:
1.) Angular ASP.NET Core applications come with an extra msbuild target that's run when publishing. This target runs npm install and npm run build -- --prod. This yields lots of console output.
2.) electronize start ends up running dotnet publish <args> using the ProcessHelper.CmdExecute method.
3.) ProcessHelper will bail out with return code 1 once it detects the sub string "error" in the process output streams.
4.) electronize start bails out because the output generated by npm run contains the string "error". In my case the exact value is "14% building 40/42 modules 2 active ...pp\src\app\views\error\404.component.ts".

Now that I know what's happening I can temp fix this issue by ensuring that npm stays silent. However I'd appreciate if you could come up with a way to prevent us from falling into this trap.

Thanks!

Originally created by @paralaxsd on GitHub (Mar 12, 2019). Originally assigned to: @GregorBiswanger on GitHub. Hi, While trying to electronize an asp.net core angular application I found a limitation in the way "electronize start" works that prevents the process from finishing successfully: Running `electronize start` in my web application directory bails with _"Error occurred during dotnet publish: 1"_ The reason for this became clear once I looked at ElectronNET.CLI: 1.) Angular ASP.NET Core applications come with an extra msbuild target that's run when publishing. This target runs `npm install` and `npm run build -- --prod`. This yields lots of console output. 2.) `electronize start` ends up running `dotnet publish <args>` using the `ProcessHelper.CmdExecute` method. 3.) ProcessHelper **will bail out with return code 1** once it detects the sub string "_error_" in the process output streams. 4.) `electronize start` bails out because the output generated by npm run contains the string "_error_". In my case the exact value is "_14% building 40/42 modules 2 active ...pp\src\app\views\error\404.component.ts_". Now that I know what's happening I can temp fix this issue by ensuring that npm stays silent. However I'd appreciate if you could come up with a way to prevent us from falling into this trap. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#289