shithub: drawterm

Download patch

ref: f502310ba1b242cab4646cb71cd00944d471f1f1
parent: f2f537484accfc6356d01c9e42d81e76d1c4938a
author: cinap_lenrek <[email protected]>
date: Sat Nov 30 14:57:17 EST 2019

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

--- a/kern/posix.c
+++ b/kern/posix.c
@@ -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
+++ b/kern/win32.c
@@ -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