-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CurrentDirectory to JclSysUtils.Execute #79
base: master
Are you sure you want to change the base?
Conversation
Hello, Thank you for this pull request. As I read it, the code changes are only valid for a Windows target. This means that the new function parameter has no impact when compiling for Linux (with FPC) and thus gives a false sense that it would serve a purpose. |
You are right, I did it this way, but I changed it right before I sent this PR 🤔, I don't even why. I change it back, like you are proposing and send an update later. |
CurrentDirectory parameter is passed to the CreateProcess Windows function
659003c
to
a585199
Compare
Done, I moved |
Thanks for that, but this does not addresss my remark about the new parameter you added to all functions. With the current code, it won't compile for LINUX. Sure, you could add a |
It will compile in Linux env. without any problems, the parameter has default value |
If you look at all |
The
CurrentDirectory
parameter is passed down to theCreateProcess
Windows function as thelpCurrentDirectory
parameter.I decided to add this parameter as the last parameter to all
JclSysUtils.Execute
functions with a default value '' ( empty string ).I added
PCurrentDirectory: PChar
insideJclSysUtils.ExecuteCmdProcess
function, because ifCurrentDirectory
is empty string,nil
have to be passed down to theCreateProcess
, in this case, the new process will have the same current drive and directory as the calling process.This PR is backward compatible, doesn't contain any breaking changes. 🤓