When starting a new session with a custom directory, the shell launcher is not invoked through login
To reproduce, set a custom directory in your profile and put something in /etc/motd. You can tell login isn't run because the motd doesn't get printed.
shell_launcher.c
says:
// This function runs the user's shell, replacing the current process with the shell, and
// inserting a "-" at the start of argv[0] to make it think it's a login shell. Unfortunately,
// Apple's login(1) doesn't let you preseve the working directory and also start a login shell,
// which iTerm2 needs to be able to do. This is meant to be run this way:
// /usr/bin/login -fpl $USER /full/path/to/iTerm.app --launch_shell
But ITAddressBookMgr.c does not call login. It should do this:
+ (NSString *)shellLauncherCommand {
return [NSString stringWithFormat:@"/usr/bin/login -fpl %@ %@ --launch_shell",
NSUserName(),
[[[NSBundle mainBundle] executablePath] stringWithEscapedShellCharacters]];
}
I seem to recall that login didn't always support a command argument; we might need to do something different for old OS versions.