Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 03156796f383f3e502a9fe8a17dbd739c4f407c2)
+++ uspace/app/bdsh/exec.c	(revision adb49f58f0f19858bac40da225e2394606a6d356)
@@ -113,4 +113,5 @@
 {
 	task_id_t tid;
+	task_exit_t texit;
 	char *tmp;
 	int retval;
@@ -127,7 +128,10 @@
 	}
 	
-	task_wait(tid, &retval);
-	if (retval != 0)
+	task_wait(tid, &texit, &retval);
+	if (texit != TASK_EXIT_NORMAL) {
+		printf("Command failed (unexpectedly terminated).\n");
+	} else if (retval != 0) {
 		printf("Command failed (return value %d).\n", retval);
+	}
 
 	return 0;
Index: uspace/app/getvc/getvc.c
===================================================================
--- uspace/app/getvc/getvc.c	(revision 03156796f383f3e502a9fe8a17dbd739c4f407c2)
+++ uspace/app/getvc/getvc.c	(revision adb49f58f0f19858bac40da225e2394606a6d356)
@@ -74,4 +74,5 @@
 int main(int argc, char *argv[])
 {
+	task_exit_t texit;
 	int retval;
 
@@ -100,5 +101,5 @@
 	version_print(argv[1]);
 	task_id_t id = spawn(argv[2]);
-	task_wait(id, &retval);
+	task_wait(id, &texit, &retval);
 	
 	return 0;
Index: uspace/lib/libc/generic/task.c
===================================================================
--- uspace/lib/libc/generic/task.c	(revision 03156796f383f3e502a9fe8a17dbd739c4f407c2)
+++ uspace/lib/libc/generic/task.c	(revision adb49f58f0f19858bac40da225e2394606a6d356)
@@ -149,11 +149,12 @@
 }
 
-int task_wait(task_id_t id, int *retval)
+int task_wait(task_id_t id, task_exit_t *texit, int *retval)
 {
-	ipcarg_t rv;
+	ipcarg_t te, rv;
 	int rc;
 
-	rc = (int) async_req_2_1(PHONE_NS, NS_TASK_WAIT, LOWER32(id),
-	    UPPER32(id), &rv);
+	rc = (int) async_req_2_2(PHONE_NS, NS_TASK_WAIT, LOWER32(id),
+	    UPPER32(id), &te, &rv);
+	*texit = te;
 	*retval = rv;
 
Index: uspace/lib/libc/include/task.h
===================================================================
--- uspace/lib/libc/include/task.h	(revision 03156796f383f3e502a9fe8a17dbd739c4f407c2)
+++ uspace/lib/libc/include/task.h	(revision adb49f58f0f19858bac40da225e2394606a6d356)
@@ -40,8 +40,13 @@
 typedef uint64_t task_id_t;
 
+typedef enum {
+	TASK_EXIT_NORMAL,
+	TASK_EXIT_UNEXPECTED
+} task_exit_t;
+
 extern task_id_t task_get_id(void);
 extern int task_set_name(const char *name);
 extern task_id_t task_spawn(const char *path, char *const argv[]);
-extern int task_wait(task_id_t id, int *retval);
+extern int task_wait(task_id_t id, task_exit_t *texit, int *retval);
 extern int task_retval(int val);
 
Index: uspace/srv/ns/task.c
===================================================================
--- uspace/srv/ns/task.c	(revision 03156796f383f3e502a9fe8a17dbd739c4f407c2)
+++ uspace/srv/ns/task.c	(revision adb49f58f0f19858bac40da225e2394606a6d356)
@@ -57,7 +57,8 @@
 typedef struct {
 	link_t link;
-	task_id_t id;    /**< Task ID. */
-	int retval;
-	bool destroyed;
+	task_id_t id;	/**< Task ID. */
+	bool finished;	/**< Task is done. */
+	bool have_rval;	/**< Task returned a value. */
+	int retval;	/**< The return value. */
 } hashed_task_t;
 
@@ -212,4 +213,5 @@
 {
 	link_t *cur;
+	task_exit_t texit;
 	
 loop:
@@ -227,10 +229,14 @@
 		
 		hashed_task_t *ht = hash_table_get_instance(link, hashed_task_t, link);
-		if (!ht->destroyed)
+		if (!ht->finished)
 			continue;
 		
-		if (!(pr->callid & IPC_CALLID_NOTIFICATION))
-			ipc_answer_1(pr->callid, EOK, ht->retval);
-		
+		if (!(pr->callid & IPC_CALLID_NOTIFICATION)) {
+			texit = ht->have_rval ? TASK_EXIT_NORMAL :
+			    TASK_EXIT_UNEXPECTED;
+			ipc_answer_2(pr->callid, EOK, texit,
+			    ht->retval);
+		}
+
 		hash_table_remove(&task_hash_table, keys, 2);
 		list_remove(cur);
@@ -243,4 +249,6 @@
 {
 	ipcarg_t retval;
+	task_exit_t texit;
+
 	unsigned long keys[2] = {
 		LOWER32(id),
@@ -258,5 +266,5 @@
 	}
 
-	if (!ht->destroyed) {
+	if (!ht->finished) {
 		/* Add to pending list */
 		pending_wait_t *pr =
@@ -277,6 +285,8 @@
 	
 out:
-	if (!(callid & IPC_CALLID_NOTIFICATION))
-		ipc_answer_1(callid, retval, ht->retval);
+	if (!(callid & IPC_CALLID_NOTIFICATION)) {
+		texit = ht->have_rval ? TASK_EXIT_NORMAL : TASK_EXIT_UNEXPECTED;
+		ipc_answer_2(callid, retval, texit, ht->retval);
+	}
 }
 
@@ -319,5 +329,6 @@
 	link_initialize(&ht->link);
 	ht->id = id;
-	ht->destroyed = false;
+	ht->finished = false;
+	ht->have_rval = false;
 	ht->retval = -1;
 	hash_table_insert(&task_hash_table, keys, &ht->link);
@@ -343,7 +354,9 @@
 	    hash_table_get_instance(link, hashed_task_t, link) : NULL;
 	
-	if ((ht == NULL) || ht->destroyed)
+	if ((ht == NULL) || ht->finished)
 		return EINVAL;
 
+	ht->finished = true;
+	ht->have_rval = true;
 	ht->retval = IPC_GET_ARG1(*call);
 
@@ -372,7 +385,8 @@
 	hashed_task_t *ht =
 	    hash_table_get_instance(link, hashed_task_t, link);
-	assert(ht != NULL);
-
-	ht->destroyed = true;
+	if (ht == NULL)
+		return EOK;
+
+	ht->finished = true;
 
 	return EOK;
