Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
SVN-HEAD binaries download
Urxae:
--- Quote from: mandrav on December 06, 2005, 11:26:25 am ---Yes, you 're right. The comment does not explain the reasoning for this change.
This was added to allow builtin shell commands to be used in pre-build and post-build steps, i.e. cp, del, etc. These do not work if not invoked within a shell.
--- End quote ---
Ah, I understand. But I think you meant copy. And I should mention cp has worked just fine for me so far :).
But still, wouldn't it be a cleaner solution to have GetConsoleShell() return the proper command? That way this code can be un-#ifdef'd, and if you put the code to detect cmd.exe/command.com in there it'll probably be easier to cache. You could even make it a setting like in the *nix version. Just enable that textbox in the compiler options, and autodetect only on first run.
Then the user could even change it if he prefers sh.exe for example ;). (though sh.exe would break copy again, but that's the user's choice: he gets backticks and other goodies in return. Besides, he could always create a copy script/alias for cp)
David Perfors:
--- Quote from: Urxae on December 06, 2005, 11:17:38 am ---I think this code should have the exact same effect, except it on win9x where it actually works now ;):
--- Code: ---#ifndef __WXMSW__
// special shell used only for build commands
if (!cmd->isRun)
{
// run the command in a shell, so backtick'd expressions can be evaluated
cmd->command = GetConsoleShell() + _T(" '") + cmd->command + _T("'");
}
#endif
--- End code ---
--- End quote ---
It doesn't have the same effect. it has to be done without quotes, else it will not compile (on XP) (with I mean with 'not compile' is that the command is not correct when I want to compile a file with the "new" version. The compiler plugin compiles correctly):
--- Code: --- #ifndef __WXMSW__
// run the command in a shell, so backtick'd expressions can be evaluated
cmd->command = GetConsoleShell() + _T(" '") + cmd->command + _T("'");
#else
cmd->command = GetConsoleShell() + cmd->command;
#endif
--- End code ---
mandrav:
--- Quote from: Urxae on December 06, 2005, 11:47:52 am ---
--- Quote from: mandrav on December 06, 2005, 11:26:25 am ---Yes, you 're right. The comment does not explain the reasoning for this change.
This was added to allow builtin shell commands to be used in pre-build and post-build steps, i.e. cp, del, etc. These do not work if not invoked within a shell.
--- End quote ---
Ah, I understand. But I think you meant copy. And I should mention cp has worked just fine for me so far :).
--- End quote ---
Well, yes, I meant copy :)
--- Quote from: Urxae on December 06, 2005, 11:47:52 am ---But still, wouldn't it be a cleaner solution to have GetConsoleShell() return the proper command? That way this code can be un-#ifdef'd, and if you put the code to detect cmd.exe/command.com in there it'll probably be easier to cache. You could even make it a setting like in the *nix version. Just enable that textbox in the compiler options, and autodetect only on first run.
Then the user could even change it if he prefers sh.exe for example ;). (though sh.exe would break copy again, but that's the user's choice: he gets backticks and other goodies in return. Besides, he could always create a copy script/alias for cp)
--- End quote ---
I didn't re-use GetConsoleShell() because it was initially created for non-windows installations. This has the side-effect that everyone has it now in their configuration as "/bin/sh". Do you see the problem?
Eventually, we will use GetConsoleShell() but we 'll have to check its value too...
EDIT: and mispunt is right about the quotes. I forgot to mention it...
EDIT2: Do you understand now why I said it needs some time to be correctly fixed/implemented?
Urxae:
--- Quote from: mispunt on December 06, 2005, 11:49:47 am ---
--- Quote from: Urxae on December 06, 2005, 11:17:38 am ---I think this code should have the exact same effect, except it on win9x where it actually works now ;):
--- Code: ---#ifndef __WXMSW__
// special shell used only for build commands
if (!cmd->isRun)
{
// run the command in a shell, so backtick'd expressions can be evaluated
cmd->command = GetConsoleShell() + _T(" '") + cmd->command + _T("'");
}
#endif
--- End code ---
--- End quote ---
It doesn't have the same effect. it has to be done without quotes, else it will not compile (on XP) (with I mean with 'not compile' is that the command is not correct when I want to compile a file with the "new" version. The compiler plugin compiles correctly):
--- End quote ---
I have a feeling you missed the #ifdef around it :).
On the windows version it would just run the command itself without any extra shell and without any extra quotes, just like it always did.
--- Quote from: mandrav on December 06, 2005, 11:54:30 am ---I didn't re-use GetConsoleShell() because it was initially created for non-windows installations. This has the side-effect that everyone has it now in their configuration as "/bin/sh". Do you see the problem?
Eventually, we will use GetConsoleShell() but we 'll have to check its value too...
--- End quote ---
The configuration file has a version number, so the most elegant way would be to bump it and have the conversion code take care of it, I think. Though bumping it for so minor a change might be an objection...
This solution does mean you wouldn't have to check the value, though. Just load the config normally but replace this particular setting by the default shell if on Windows and the config file version was 1.
--- Quote ---EDIT: and mispunt is right about the quotes. I forgot to mention it...
--- End quote ---
See above
mandrav:
--- Quote from: Urxae on December 06, 2005, 12:00:48 pm ---
--- Quote ---EDIT: and mispunt is right about the quotes. I forgot to mention it...
--- End quote ---
See above
--- End quote ---
Mispunt is referring to using GetConsoleShell() under both platforms. For windows it would be cmd /c arguments while for linux it would be /bin/sh 'arguments' (notice the quotes).
Your solution is to revert to the previous way, which does not allow for builtin shell commands (i.e. for windows, no command shell).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version