mirror of
https://review.haiku-os.org/haiku
synced 2025-02-01 03:06:08 +01:00
* Changed the alert message translation to something which makes a bit more
sense, and is less error prone. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36711 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b2f1b28640
commit
181511caad
@ -511,23 +511,26 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg
|
||||
|
||||
execve(argv[0], (char * const *)argv, environ);
|
||||
|
||||
/*
|
||||
* Exec failed.
|
||||
* TODO: This doesn't belong here.
|
||||
*/
|
||||
// Exec failed.
|
||||
// TODO: This doesn't belong here.
|
||||
|
||||
sleep(1);
|
||||
BString knonLocalizedPart = "alert --stop ";
|
||||
const char *kLocalizedPart =
|
||||
B_TRANSLATE("'Cannot execute \"%s\":\n\t%s' 'Use default shell' 'Abort'");
|
||||
const char *spawnAlertMessage = knonLocalizedPart << kLocalizedPart;
|
||||
char errorMessage[256];
|
||||
snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, argv[0], strerror(errno));
|
||||
|
||||
int returnValue = system(errorMessage);
|
||||
if (returnValue == 0)
|
||||
BString alertCommand = "alert --stop '";
|
||||
alertCommand += B_TRANSLATE("Cannot execute \"%command\":\n\t%error");
|
||||
alertCommand += "' '";
|
||||
alertCommand += B_TRANSLATE("Use default shell");
|
||||
alertCommand += "' '";
|
||||
alertCommand += B_TRANSLATE("Abort");
|
||||
alertCommand += "'";
|
||||
alertCommand.ReplaceFirst("%command", argv[0]);
|
||||
alertCommand.ReplaceFirst("%error", strerror(errno));
|
||||
|
||||
int returnValue = system(alertCommand.String());
|
||||
if (returnValue == 0) {
|
||||
execl(kDefaultShellCommand[0], kDefaultShellCommand[0],
|
||||
kDefaultShellCommand[1], NULL);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user