aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-23 10:21:39 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-23 10:21:39 +1000
commitd9c358ba831824913a37d578be35e2df3b1705e4 (patch)
treebbe2062179a51a28eeccf501c07a21833bb1ca86
parentf0a41fbc1bf2a64c1af6433f6311098d3481626d (diff)
parentfdc69a4b0eadfefaf1247f868953a896aa73e2f2 (diff)
downloadbusybox-w32-d9c358ba831824913a37d578be35e2df3b1705e4.tar.gz
busybox-w32-d9c358ba831824913a37d578be35e2df3b1705e4.tar.bz2
busybox-w32-d9c358ba831824913a37d578be35e2df3b1705e4.zip
Merge branch 'ash'
-rw-r--r--BUGS3
-rw-r--r--shell/ash.c25
2 files changed, 28 insertions, 0 deletions
diff --git a/BUGS b/BUGS
index a0e096a7e..8a31ca3de 100644
--- a/BUGS
+++ b/BUGS
@@ -16,6 +16,9 @@ unlzma < foo.lzma | bar does work though
16 16
17^Z can be used while ^D does not work 17^Z can be used while ^D does not work
18 18
19^C sometimes does not work (Ctrl-Break always works though).
20This may have something to do with read_key()?
21
19** $HOME not set 22** $HOME not set
20 23
21$HOMEPATH should probably be used 24$HOMEPATH should probably be used
diff --git a/shell/ash.c b/shell/ash.c
index c3b497938..5c24762f2 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4050,6 +4050,18 @@ sprint_status(char *s, int status, int sigonly)
4050} 4050}
4051 4051
4052#if ENABLE_PLATFORM_MINGW32 4052#if ENABLE_PLATFORM_MINGW32
4053
4054HANDLE hSIGINT; /* Ctrl-C is pressed */
4055
4056static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
4057{
4058 if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) {
4059 SetEvent(hSIGINT);
4060 return TRUE;
4061 }
4062 return FALSE;
4063}
4064
4053/* 4065/*
4054 * Windows does not know about parent-child relationship 4066 * Windows does not know about parent-child relationship
4055 * They don't support waitpid(-1) 4067 * They don't support waitpid(-1)
@@ -4081,7 +4093,9 @@ waitpid_child(int *status)
4081 LOOP(pid_nr++); 4093 LOOP(pid_nr++);
4082 if (!pid_nr) 4094 if (!pid_nr)
4083 return -1; 4095 return -1;
4096 pid_nr++;
4084 pidp = pidlist = ckmalloc(sizeof(*pidlist)*pid_nr); 4097 pidp = pidlist = ckmalloc(sizeof(*pidlist)*pid_nr);
4098 *pidp++ = hSIGINT;
4085 LOOP(*pidp++ = (HANDLE)ps->ps_pid); 4099 LOOP(*pidp++ = (HANDLE)ps->ps_pid);
4086 #undef LOOP 4100 #undef LOOP
4087 4101
@@ -4090,6 +4104,15 @@ waitpid_child(int *status)
4090 free(pidlist); 4104 free(pidlist);
4091 return -1; 4105 return -1;
4092 } 4106 }
4107 if (!idx) { /* hSIGINT */
4108 int i;
4109 ResetEvent(hSIGINT);
4110 for (i = 1; i < pid_nr; i++)
4111 TerminateProcess(pidlist[i], 1);
4112 free(pidlist);
4113 *status = 260; /* terminated by a signal */
4114 return pidlist[1];
4115 }
4093 GetExitCodeProcess(pidlist[idx], &win_status); 4116 GetExitCodeProcess(pidlist[idx], &win_status);
4094 pid = (int)pidlist[idx]; 4117 pid = (int)pidlist[idx];
4095 free(pidlist); 4118 free(pidlist);
@@ -13593,6 +13616,8 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13593 setstackmark(&smark); 13616 setstackmark(&smark);
13594 13617
13595#if ENABLE_PLATFORM_MINGW32 13618#if ENABLE_PLATFORM_MINGW32
13619 hSIGINT = CreateEvent(NULL, TRUE, FALSE, NULL);
13620 SetConsoleCtrlHandler(ctrl_handler, TRUE);
13596 if (argc == 3 && !strcmp(argv[1], "--forkshell")) { 13621 if (argc == 3 && !strcmp(argv[1], "--forkshell")) {
13597 forkshell_init(argv[2]); 13622 forkshell_init(argv[2]);
13598 13623