First of all, thank you for this very nice tool! We use this in our own SonarQube plugin, but have a problem if we use ShellExecute in the program we are testing. If you start another program from within the executable you are testing, it will block and start consuming a lot of CPU, and the other program is not fully started (you can see it in process explorer but the first line in the DPR is never executed).
You can simply reproduce it by making a small program that only executes the following function:
function FileExecuteBlocking(AHwnd: Cardinal; const AFileName, AParams, AStartDir: String; AShowCmd: Integer; AWait: Boolean): Integer; //execute a file while blocking waiting until it is finished var LInfo: TShellExecuteInfo; LExitCode: DWORD; begin Result := -1; //Info FillChar(LInfo, SizeOf(LInfo), 0); LInfo.cbSize := SizeOf(TShellExecuteInfo); LInfo.fMask := SEE_MASK_NOCLOSEPROCESS; LInfo.Wnd := AHwnd; LInfo.lpFile := PChar(AFileName); LInfo.lpParameters := PChar(AParams); LInfo.lpDirectory := PChar(AStartDir); LInfo.nShow := AShowCmd; if ShellExecuteEx(@LInfo) then begin if AWait then begin repeat Sleep(100); GetExitCodeProcess(LInfo.hProcess, LExitCode); until (LExitCode <> STILL_ACTIVE); Result := LExitCode; end; end end; LResult := FileExecuteBlocking(0, <my executable>, '', '', SW_SHOWNORMAL, True);
I have solved my issue by changing the value of DebugEventHandlingResult in procedure TDebugger.ProcessDebugEvents to Cardinal(DBG_EXCEPTION_NOT_HANDLED). This makes sure that any exception that is raised in the subprocess is handled the way it should be.
The project is moved to github. Can you open up a PR there?
https://github.com/DelphiCodeCoverage/DelphiCodeCoverage
Are you sure? The code and release here seem newer than on GitHub.
Correct, this code is newer, but contains some problems. Can can find an up-to-date version with fixes in our repository: https://github.com/mendrix/DelphiCodeCoverage
@mendrix: Thanks for continuing the project. Do you plan to make releases in this repository?
Hi,
No, I'm not planning to make releases in this repository. I have forked the most recent version of this tool (there are multiple forks) on GitHub and made changes to it in our repository. So, the most up-to-date version of this tool is now in our repository: https://github.com/mendrix/DelphiCodeCoverage
I meant: Do you plan to make releases in your own fork, based on your changes?
Yes, definitely, I would really appreciate if our fork gets more support from the Delphi community and I want to keep it active and alive :-)
This is good news. I have opened an issue in your GitHub fork, have you seen it?
Yes, I have. Have you seen my comments? You should try it with the latest (master) code and see if you can reproduce it.
Met vriendelijke groet,
Laurens van Run | Directeur
[cid:image002.jpg@01D711A6.2932D700]http://www.mendrix.nl/delivery/
Voor nieuwste ontwikkelingen van onze app kijk op: MendriX Mobilehttps://www.mendrix.nl/mobile/ en op gebied van ons TMS: MendriX TMShttps://www.mendrix.nl/tms/ en vergeet niet onze nieuwsberichten: MendriX Nieuwshttps://www.mendrix.nl/nieuws/.
L.vanRun@mendrix.nlL.vanRun@mendrix.nl | www.mendrix.nlhttp://www.mendrix.nl/
T: +31(0)346 290 700
Vragen en ondersteuning via wiki.mendrix.nl of via wiki@MendriX.nlwiki@MendriX.nl.
MendriX is ingeschreven bij de Kamer van Koophandel te Utrecht onder nummer 30189917. Aan deze e-mail kunnen geen rechten worden ontleend. Denk aan het milieu voordat u dit e-mailbericht print.
Van: Joachim Marder jomarder@users.sourceforge.net
Verzonden: vrijdag 5 maart 2021 08:59
Aan: [delphicodecoverage:tickets] 70@tickets.delphicodecoverage.p.re.sourceforge.net
Onderwerp: [delphicodecoverage:tickets] #70 Unable to use ShellExecute
This is good news. I have opened an issue in your GitHub fork, have you seen it?
[tickets:#70]https://sourceforge.net/p/delphicodecoverage/tickets/70/ Unable to use ShellExecute
Status: New
Created: Wed Apr 15, 2020 07:59 AM UTC by Laurens van Run
Last Updated: Fri Mar 05, 2021 07:47 AM UTC
Owner: nobody
First of all, thank you for this very nice tool! We use this in our own SonarQube plugin, but have a problem if we use ShellExecute in the program we are testing. If you start another program from within the executable you are testing, it will block and start consuming a lot of CPU, and the other program is not fully started (you can see it in process explorer but the first line in the DPR is never executed).
You can simply reproduce it by making a small program that only executes the following function:
function FileExecuteBlocking(AHwnd: Cardinal; const AFileName, AParams, AStartDir: String; AShowCmd: Integer; AWait: Boolean): Integer;
//execute a file while blocking waiting until it is finished
var
LInfo: TShellExecuteInfo;
LExitCode: DWORD;
begin
Result := -1;
//Info
FillChar(LInfo, SizeOf(LInfo), 0);
LInfo.cbSize := SizeOf(TShellExecuteInfo);
LInfo.fMask := SEE_MASK_NOCLOSEPROCESS;
LInfo.Wnd := AHwnd;
LInfo.lpFile := PChar(AFileName);
LInfo.lpParameters := PChar(AParams);
LInfo.lpDirectory := PChar(AStartDir);
LInfo.nShow := AShowCmd;
if ShellExecuteEx(@LInfo) then begin
end
end;
LResult := FileExecuteBlocking(0, <my executable="">, '', '', SW_SHOWNORMAL, True);</my>
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/delphicodecoverage/tickets/70/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Tickets:
#70Yes, I have seen your comments.
This is why I asked about a current release. The Win64 build target does not compile with Delphi 10.4.2:
Would you like me to open an issue for that?
Yes please, I have not yet tested it in Delphi 10.4.2 (uses 10.2.3 right now). Feel free to fix it and create a pull request.
Met vriendelijke groet,
Laurens van Run | Directeur
[cid:image002.jpg@01D711D0.F46071B0]http://www.mendrix.nl/delivery/
Voor nieuwste ontwikkelingen van onze app kijk op: MendriX Mobilehttps://www.mendrix.nl/mobile/ en op gebied van ons TMS: MendriX TMShttps://www.mendrix.nl/tms/ en vergeet niet onze nieuwsberichten: MendriX Nieuwshttps://www.mendrix.nl/nieuws/.
L.vanRun@mendrix.nlL.vanRun@mendrix.nl | www.mendrix.nlhttp://www.mendrix.nl/
T: +31(0)346 290 700
Vragen en ondersteuning via wiki.mendrix.nl of via wiki@MendriX.nlwiki@MendriX.nl.
MendriX is ingeschreven bij de Kamer van Koophandel te Utrecht onder nummer 30189917. Aan deze e-mail kunnen geen rechten worden ontleend. Denk aan het milieu voordat u dit e-mailbericht print.
Van: Joachim Marder jomarder@users.sourceforge.net
Verzonden: vrijdag 5 maart 2021 14:55
Aan: [delphicodecoverage:tickets] 70@tickets.delphicodecoverage.p.re.sourceforge.net
Onderwerp: [delphicodecoverage:tickets] #70 Unable to use ShellExecute
Have you seen my comments
Yes, I have seen your comments.
You should try it with the latest (master) code and see if you can reproduce it.
This is why I asked about a current release. The Win64 build target does not compile with Delphi 10.4.2:
[dcc64 Error] Debugger.pas(906): E2003 Undeclared identifier: 'Rip'
[dcc64 Fatal Error] CodeCoverage.dpr(21): F2063 Could not compile used unit 'Debugger.pas'
Would you like me to open an issue for that?
[tickets:#70]https://sourceforge.net/p/delphicodecoverage/tickets/70/ Unable to use ShellExecute
Status: New
Created: Wed Apr 15, 2020 07:59 AM UTC by Laurens van Run
Last Updated: Fri Mar 05, 2021 07:58 AM UTC
Owner: nobody
First of all, thank you for this very nice tool! We use this in our own SonarQube plugin, but have a problem if we use ShellExecute in the program we are testing. If you start another program from within the executable you are testing, it will block and start consuming a lot of CPU, and the other program is not fully started (you can see it in process explorer but the first line in the DPR is never executed).
You can simply reproduce it by making a small program that only executes the following function:
function FileExecuteBlocking(AHwnd: Cardinal; const AFileName, AParams, AStartDir: String; AShowCmd: Integer; AWait: Boolean): Integer;
//execute a file while blocking waiting until it is finished
var
LInfo: TShellExecuteInfo;
LExitCode: DWORD;
begin
Result := -1;
//Info
FillChar(LInfo, SizeOf(LInfo), 0);
LInfo.cbSize := SizeOf(TShellExecuteInfo);
LInfo.fMask := SEE_MASK_NOCLOSEPROCESS;
LInfo.Wnd := AHwnd;
LInfo.lpFile := PChar(AFileName);
LInfo.lpParameters := PChar(AParams);
LInfo.lpDirectory := PChar(AStartDir);
LInfo.nShow := AShowCmd;
if ShellExecuteEx(@LInfo) then begin
end
end;
LResult := FileExecuteBlocking(0, <my executable="">, '', '', SW_SHOWNORMAL, True);</my>
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/delphicodecoverage/tickets/70/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Tickets:
#70I opened https://github.com/mendrix/DelphiCodeCoverage/issues/2
Laurens, Joachim,
I just want to say I appreciate you guys enhancing DelphiCodeCoverage.
The one person having made most enhancements in the past years is Eugene Kotlyarov. And together with him, I moved the latest code to Github, starting a new "organization" to make it independent of any one person/company.
And the code there is a little bit newer than what you find here on sourceforge;
https://github.com/DelphiCodeCoverage/DelphiCodeCoverage
I invited you to that organization so that you guys can create PRs and releases in that organization. It would be nice if the project could have a home, instead of different forks created by different people.
What do you guys think?
I have been a Mac user for many years now, but am hoping to build a PC soon so I can compile this project again after many years of absence.
Thanks,
Christer
Hi Christer and Joachim,
It would really be nice if the project has a home, in stead of different forks by different people/organizations. AFAIK there is only one fork that is actively maintained, and that is the one we maintain: GitHub - mendrix/DelphiCodeCoveragehttps://github.com/mendrix/DelphiCodeCoverage 😊 Unfortunately, I haven’t forked it from your GitHub repository, so I can’t create a pull request. But I can of course create a diff and merge it into that repository.
For me it would be nice if we could combine this with the Delphi SonarQube plugin I have been working on, because we (and I guess also Joachim) is using these in combination.
Joachim, what about creating one place for both repositories? This hopefully creates a bigger community for Delphi code quality and measuring quality!
Best regards,
Met vriendelijke groet,
Laurens van Run | Directeur
[cid:image001.jpg@01D714C2.85DE7A80]http://www.mendrix.nl/delivery/
Voor nieuwste ontwikkelingen van onze app kijk op: MendriX Mobilehttps://www.mendrix.nl/mobile/ en op gebied van ons TMS: MendriX TMShttps://www.mendrix.nl/tms/ en vergeet niet onze nieuwsberichten: MendriX Nieuwshttps://www.mendrix.nl/nieuws/.
L.vanRun@mendrix.nlL.vanRun@mendrix.nl | www.mendrix.nlhttp://www.mendrix.nl/
T: +31(0)346 290 700
Vragen en ondersteuning via wiki.mendrix.nl of via wiki@MendriX.nlwiki@MendriX.nl.
MendriX is ingeschreven bij de Kamer van Koophandel te Utrecht onder nummer 30189917. Aan deze e-mail kunnen geen rechten worden ontleend. Denk aan het milieu voordat u dit e-mailbericht print.
Van: Christer Fahlgren christerfah@users.sourceforge.net
Verzonden: dinsdag 9 maart 2021 07:20
Aan: [delphicodecoverage:tickets] 70@tickets.delphicodecoverage.p.re.sourceforge.net
Onderwerp: [delphicodecoverage:tickets] #70 Unable to use ShellExecute
Laurens, Joachim,
I just want to say I appreciate you guys enhancing DelphiCodeCoverage.
The one person having made most enhancements in the past years is Eugene Kotlyarov. And together with him, I moved the latest code to Github, starting a new "organization" to make it independent of any one person/company.
And the code there is a little bit newer than what you find here on sourceforge;
https://github.com/DelphiCodeCoverage/DelphiCodeCoverage
I invited you to that organization so that you guys can create PRs and releases in that organization. It would be nice if the project could have a home, instead of different forks created by different people.
What do you guys think?
I have been a Mac user for many years now, but am hoping to build a PC soon so I can compile this project again after many years of absence.
Thanks,
Christer
[tickets:#70]https://sourceforge.net/p/delphicodecoverage/tickets/70/ Unable to use ShellExecute
Status: New
Created: Wed Apr 15, 2020 07:59 AM UTC by Laurens van Run
Last Updated: Sat Mar 06, 2021 08:58 AM UTC
Owner: nobody
First of all, thank you for this very nice tool! We use this in our own SonarQube plugin, but have a problem if we use ShellExecute in the program we are testing. If you start another program from within the executable you are testing, it will block and start consuming a lot of CPU, and the other program is not fully started (you can see it in process explorer but the first line in the DPR is never executed).
You can simply reproduce it by making a small program that only executes the following function:
function FileExecuteBlocking(AHwnd: Cardinal; const AFileName, AParams, AStartDir: String; AShowCmd: Integer; AWait: Boolean): Integer;
//execute a file while blocking waiting until it is finished
var
LInfo: TShellExecuteInfo;
LExitCode: DWORD;
begin
Result := -1;
//Info
FillChar(LInfo, SizeOf(LInfo), 0);
LInfo.cbSize := SizeOf(TShellExecuteInfo);
LInfo.fMask := SEE_MASK_NOCLOSEPROCESS;
LInfo.Wnd := AHwnd;
LInfo.lpFile := PChar(AFileName);
LInfo.lpParameters := PChar(AParams);
LInfo.lpDirectory := PChar(AStartDir);
LInfo.nShow := AShowCmd;
if ShellExecuteEx(@LInfo) then begin
end
end;
LResult := FileExecuteBlocking(0, <my executable="">, '', '', SW_SHOWNORMAL, True);</my>
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/delphicodecoverage/tickets/70/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Tickets:
#70@mendrix: Well, we have actually created a fork of the SonarDelphi plugin, because you did not have issues activated for your fork. The fork is here: https://github.com/JAM-Software/SonarDelphi
The plugin was unable to parse our code and we didn't see any activitly in the past years in the various forks.
I don't think this is necessary as long as they are properly cross-linked and maintained.
I think more important are regular releases, an activated issue tracker and quick responses to pull requests. Also, SonarDelphi should be listed among the official plugins on the SonarQube site.
It would be great if you could merge your code changes for CodeCoverage.
Hey guys
Sorry for not being responsive recently, I think it is better to keep one
repository on github to avoid confusion. I see Lauren is now part of DCC
organization on github so he can merge changes there, or I can try to merge
it sometime this week.
On Tue, 9 Mar 2021 at 03:20, Joachim Marder jomarder@users.sourceforge.net
wrote:
Related
Tickets:
#70Agree, is it possible to reinvate me to DCC on my private GitHub account (Laurensvanrun) so I can merge my changes?
Thanks, I have merged your changes in our repository.
Hi
I sent you an invite Lauren
On Wed, Mar 10, 2021, 06:05 Laurens van Run mendrix@users.sourceforge.net
wrote:
Related
Tickets:
#70I've merged this change in github repository
Hi Eugene, thanks for merging this. I tried to push my other changes to the repos, but get a 403 :-( Can you give me the correct right?
Hi Laurens, try pushing again it should work now.