pty_process *process = process_init((void *) pss, server->loop, argv);
if (columns > 0) process->columns = columns;
if (rows > 0) process->rows = rows;
+ strncpy(process->term, server->terminal_type, sizeof(process->term));
if (pty_spawn(process, process_read_cb, process_exit_cb) != 0) {
lwsl_err("pty_spawn: %d (%s)\n", errno, strerror(errno));
process_free(process);
cmdline = join_args(process->argv);
if (cmdline == NULL) goto cleanup;
+ // TODO: restore env after process creation
+ if (!SetEnvironmentVariable("TERM", process->term)) {
+ print_error("SetEnvironmentVariable");
+ }
+
if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, NULL, &process->si.StartupInfo, &pi)) {
print_error("CreateProcessW");
goto cleanup;
return status;
} else if (pid == 0) {
setsid();
+ setenv("TERM", process->term, true);
int ret = execvp(process->argv[0], process->argv);
if (ret < 0) {
perror("execvp failed\n");