code: 9ferno

Download patch

ref: 7ab638a68075173cb976eb56ce28d79ad4f38fd2
parent: 819fc1850e53f5094cc06431ed719759dd685885
author: 9ferno <gophone2015@gmail.com>
date: Mon Jan 10 21:16:27 EST 2022

clean up shell debug prints

--- a/appl/cmd/sh/sh.b
+++ b/appl/cmd/sh/sh.b
@@ -782,7 +782,7 @@
 runexternal(ctxt: ref Context, args: list of ref Listnode, last: int): string
 {
 	progname := (hd args).word;
-	if (DEBUG) debug(sys->sprint("runexternal progname %s\n", progname));
+	if (DEBUG) debug(sys->sprint("runexternal progname %s", progname));
 	disfile := 0;
 	if (len progname >= 4 && progname[len progname-4:] == ".dis")
 		disfile = 1;
@@ -802,11 +802,11 @@
 		else
 			path = progname;
 
-		if (DEBUG) debug(sys->sprint("runexternal path %s\n", path));
+		if (DEBUG) debug(sys->sprint("runexternal path %s", path));
 		npath := path;
 		if (!disfile)
 			npath += ".dis";
-		if (DEBUG) debug(sys->sprint("runexternal npath %s\n", npath));
+		if (DEBUG) debug(sys->sprint("runexternal npath %s", npath));
 		mod := load Command npath;
 		if (mod != nil) {
 			if (DEBUG) debug(sys->sprint("runexternal npath %s mod != nil\n", npath));
@@ -813,13 +813,13 @@
 			argv := list2stringlist(args);
 			export(ctxt.env.localenv);
 
-			if (DEBUG) debug(sys->sprint("runexternal mod != nil\n"));
+			if (DEBUG) debug(sys->sprint("runexternal mod != nil"));
 			if (last) {
 				{
 					sys->pctl(Sys->NEWFD, ctxt.keepfds);
-					if (DEBUG) debug(sys->sprint("runexternal before mod->init\n"));
+					if (DEBUG) debug(sys->sprint("runexternal before mod->init"));
 					mod->init(ctxt.drawcontext, argv);
-					if (DEBUG) debug(sys->sprint("runexternal after mod->init\n"));
+					if (DEBUG) debug(sys->sprint("runexternal after mod->init"));
 					exit;
 				} exception e {
 				EPIPE =>
@@ -834,7 +834,7 @@
 			if (DEBUG) debug("started external externalexec; pid is "+string pid);
 			return waitfor(ctxt, pid :: nil);
 		}
-		if (DEBUG) debug(sys->sprint("runexternal npath %s mod == nil\n", npath));
+		if (DEBUG) debug(sys->sprint("runexternal npath %s mod == nil", npath));
 		err = sys->sprint("%r");
 		if (nonexistent(err)) {
 			# try and run it as a shell script