Changeset d027731b1848a3f06462a0aa71fd9e5926e14c9a
- Timestamp:
- 11/18/10 02:25:20 (3 years ago)
- Author:
- Nedko Arnaudov <nedko@…>
- Children:
- c7d0a6a4794f10a73d8c2cb103aa1c33c1b7ce69
- Parents:
- a88ec8d69f922fad91f61239c8a7c84f915b825c
- git-author:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-11-18T02:15:38Z+0200
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-11-18T02:25:20Z+0200
- Message:
-
ladishd: start terminal apps through shell
This will allow expansion of env vars used in commandline to happen
when apps are started in terminal. It already happens when apps are
started without terminal.
This breaks the default title, at least for xterm. For it, it is now
set explicitly.
Starting through shell is not used when there is no '$' in the
commandline. This should minimize the title problems when xterm is not
used.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
ra88ec8d
|
rd027731
|
|
| 256 | 256 | #endif |
| 257 | 257 | |
| 258 | | static void loader_exec_program(const char * commandline, const char * working_dir, bool run_in_terminal) |
| 259 | | { |
| 260 | | const char * argv[4]; |
| | 258 | static |
| | 259 | void |
| | 260 | loader_exec_program( |
| | 261 | const char * commandline, |
| | 262 | const char * working_dir, |
| | 263 | bool run_in_terminal, |
| | 264 | const char * vgraph_name, |
| | 265 | const char * app_name) |
| | 266 | { |
| | 267 | const char * argv[8]; |
| | 268 | unsigned int i; |
| 261 | 269 | |
| 262 | 270 | /* for non terminal processes we use forkpty() that calls login_tty() that calls setsid() */ |
| … |
… |
|
| 277 | 285 | } |
| 278 | 286 | |
| | 287 | i = 0; |
| | 288 | |
| 279 | 289 | if (run_in_terminal) |
| 280 | 290 | { |
| 281 | | if (!conf_get(LADISH_CONF_KEY_DAEMON_TERMINAL, argv)) |
| 282 | | { |
| 283 | | argv[0] = LADISH_CONF_KEY_DAEMON_TERMINAL_DEFAULT; |
| 284 | | } |
| 285 | | |
| 286 | | argv[1] = "-e"; |
| 287 | | } |
| 288 | | else |
| 289 | | { |
| 290 | | if (!conf_get(LADISH_CONF_KEY_DAEMON_SHELL, argv)) |
| 291 | | { |
| 292 | | argv[0] = LADISH_CONF_KEY_DAEMON_SHELL_DEFAULT; |
| 293 | | } |
| 294 | | |
| 295 | | argv[1] = "-c"; |
| 296 | | } |
| 297 | | |
| 298 | | argv[2] = commandline; |
| 299 | | argv[3] = NULL; |
| | 291 | if (!conf_get(LADISH_CONF_KEY_DAEMON_TERMINAL, argv + i)) |
| | 292 | { |
| | 293 | argv[i] = LADISH_CONF_KEY_DAEMON_TERMINAL_DEFAULT; |
| | 294 | } |
| | 295 | i++; |
| | 296 | |
| | 297 | if (strcmp(argv[0], "xterm") == 0 && |
| | 298 | strchr(app_name, '"') == NULL && |
| | 299 | strchr(app_name, '\'') == NULL && |
| | 300 | strchr(app_name, '`') == NULL) |
| | 301 | { |
| | 302 | argv[i++] = "-T"; |
| | 303 | argv[i++] = app_name; |
| | 304 | } |
| | 305 | |
| | 306 | argv[i++] = "-e"; |
| | 307 | } |
| | 308 | |
| | 309 | if (!conf_get(LADISH_CONF_KEY_DAEMON_SHELL, argv + i)) |
| | 310 | { |
| | 311 | argv[i] = LADISH_CONF_KEY_DAEMON_SHELL_DEFAULT; |
| | 312 | } |
| | 313 | i++; |
| | 314 | |
| | 315 | argv[i++] = "-c"; |
| | 316 | |
| | 317 | argv[i++] = commandline; |
| | 318 | argv[i++] = NULL; |
| 300 | 319 | |
| 301 | 320 | log_info("Executing '%s' with PID %llu", commandline, (unsigned long long)getpid()); |
| … |
… |
|
| 555 | 574 | putenv("LD_PRELOAD=libalsapid.so"); |
| 556 | 575 | |
| 557 | | loader_exec_program(commandline, working_dir, run_in_terminal); |
| | 576 | loader_exec_program(commandline, working_dir, run_in_terminal, vgraph_name, app_name); |
| 558 | 577 | |
| 559 | 578 | return false; /* We should never get here */ |