Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision 5462a309a54b0194d3fc8597ad378e1102e5c26c)
+++ uspace/app/trace/trace.c	(revision 6e3a44ab50a3067e6c8ff8affb5a71528cdca5a3)
@@ -84,4 +84,5 @@
 static task_id_t task_id;
 static loader_t *task_ldr;
+static int task_wait_for;
 
 /** Combination of events/data to print. */
@@ -861,4 +862,5 @@
 				task_id = strtol(*argv, &err_p, 10);
 				task_ldr = NULL;
+				task_wait_for = 0;
 				if (*err_p) {
 					printf("Task ID syntax error\n");
@@ -898,4 +900,5 @@
 	}
 	task_ldr = preload_task(*argv, argv, &task_id);
+	task_wait_for = 1;
 
 	return 0;
@@ -905,4 +908,6 @@
 {
 	int rc;
+	task_exit_t texit;
+	int retval;
 
 	printf("System Call / IPC Tracer\n");
@@ -924,11 +929,27 @@
 	printf("Connected to task %lld.\n", task_id);
 
-	if (task_ldr != NULL) {
+	if (task_ldr != NULL)
 		program_run();
-	}
 
 	cev_fibril_start();
 	trace_task(task_id);
 
+	if (task_wait_for) {
+		printf("Waiting for task to exit.\n");
+
+		rc = task_wait(task_id, &texit, &retval);
+		if (rc != EOK) {
+			printf("Failed waiting for task.\n");
+			return -1;
+		}
+
+		if (texit == TASK_EXIT_NORMAL) {
+			printf("Task exited normally, return value %d.\n",
+			    retval);
+		} else {
+			printf("Task exited unexpectedly.\n");
+		}
+	}
+
 	return 0;
 }
