shithub: drawterm

Download patch

ref: f502310ba1b242cab4646cb71cd00944d471f1f1
parent: f2f537484accfc6356d01c9e42d81e76d1c4938a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Nov 30 13:57:17 EST 2019

devcmd: format a 5-field status line in oscmdwait() as described by cmd(3)

--- a/kern/posix.c	Mon Nov 25 17:38:05 2019
+++ b/kern/posix.c	Sat Nov 30 13:57:17 2019
@@ -231,7 +231,9 @@
 
 	if(waitpid(pid, &wstatus, 0) < 0)
 		return -1;
-	return snprint(status, nstatus, "%d", wstatus);
+	if(wstatus == 0)
+		return snprint(status, nstatus, "0 0 0 0 ''");
+	return snprint(status, nstatus, "0 0 0 0 %d", (int)wstatus);
 }
 
 #undef kill
--- a/kern/win32.c	Mon Nov 25 17:38:05 2019
+++ b/kern/win32.c	Sat Nov 30 13:57:17 2019
@@ -421,7 +421,9 @@
 			break;
 		WaitForSingleObject((HANDLE)c, INFINITE);
 	}
-	return snprint(status, nstatus, "%d", (int)code);
+	if(code == 0)
+		return snprint(status, nstatus, "0 0 0 0 ''");
+	return snprint(status, nstatus, "0 0 0 0 %d", (int)code);
 }
 
 int