X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=7cc5bc4efc91d8e3a34f5a4bc980cc6b2266298d;hb=c1bc67d13894b1b9456fb85abdabc4dbb5d71bcc;hp=2642ad173426787cae9f7ac09857c4116f73d6a3;hpb=88007006e2caf2c9f33c4099c0b04e3a806498aa;p=nssm.git diff --git a/gui.cpp b/gui.cpp index 2642ad1..7cc5bc4 100644 --- a/gui.cpp +++ b/gui.cpp @@ -134,6 +134,21 @@ int install(HWND window) { check_io("stdin", service->stdin_path, sizeof(service->stdin_path), IDC_STDIN); check_io("stdout", service->stdout_path, sizeof(service->stdout_path), IDC_STDOUT); check_io("stderr", service->stderr_path, sizeof(service->stderr_path), IDC_STDERR); + /* I/O defaults. */ + service->stdin_sharing = NSSM_STDIN_SHARING; + service->stdin_disposition = NSSM_STDIN_DISPOSITION; + service->stdin_flags = NSSM_STDIN_FLAGS; + service->stdout_sharing = NSSM_STDOUT_SHARING; + service->stdout_disposition = NSSM_STDOUT_DISPOSITION; + service->stdout_flags = NSSM_STDOUT_FLAGS; + service->stderr_sharing = NSSM_STDERR_SHARING; + service->stderr_disposition = NSSM_STDERR_DISPOSITION; + service->stderr_flags = NSSM_STDERR_FLAGS; + /* Override stdout and/or stderr. */ + if (SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TRUNCATE, BM_GETCHECK, 0, 0) & BST_CHECKED) { + if (service->stdout_path[0]) service->stdout_disposition = CREATE_ALWAYS; + if (service->stderr_path[0]) service->stderr_disposition = CREATE_ALWAYS; + } /* Get environment. */ unsigned long envlen = (unsigned long) SendMessage(GetDlgItem(tablist[NSSM_TAB_ENVIRONMENT], IDC_ENVIRONMENT), WM_GETTEXTLENGTH, 0, 0); @@ -157,7 +172,7 @@ int install(HWND window) { unsigned long i, j; for (i = 0; i < envlen; i++) if (env[i] != '\r') newlen++; /* Must end with two NULLs. */ - newlen++; + newlen += 2; char *newenv = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newlen); if (! newenv) {