[issm-svn] r22169 - issm/trunk/src/m/os

morlighe at issm.ess.uci.edu morlighe at issm.ess.uci.edu
Thu Oct 12 14:45:29 PDT 2017


Author: morlighe
Date: 2017-10-12 14:45:29 -0700 (Thu, 12 Oct 2017)
New Revision: 22169

Modified:
   issm/trunk/src/m/os/issmbbftpin.m
   issm/trunk/src/m/os/issmscpin.m
Log:
CHG: better way of dealing with warnings

Modified: issm/trunk/src/m/os/issmbbftpin.m
===================================================================
--- issm/trunk/src/m/os/issmbbftpin.m	2017-10-11 17:54:14 UTC (rev 22168)
+++ issm/trunk/src/m/os/issmbbftpin.m	2017-10-12 21:45:29 UTC (rev 22169)
@@ -9,15 +9,11 @@
 hostname=oshostname();
 
 %first be sure packages are not in the current directory, this could conflict with pscp on windows. 
-%get initial warning mode
-state=warning('query', 'all');
-%remove warnings in case the files do not exist
-warning off
 for i=1:numel(packages),
-	delete(packages{i});
+	if exist(packages{i},'file'),
+		delete(packages{i});
+	end
 end
-%back to initial warning state
-warning(state);
 
 %if hostname and host are the same, do a simple copy
 if strcmpi(hostname,host),
@@ -30,7 +26,7 @@
 
 	%build a string of the type: bbftp -s -u elarour -e 'setnbstream 8; cd /nobackupp10/elarour/Testing/Interactive3/; get Antarctica.outbin' pfe1.nas.nasa.gov
 	command=['!bbftp -s -V -u ' login ' -e ''setnbstream 8; cd ' path '; '];
-	for i=1:length(packages),
+	for i=1:numel(packages),
 		command=[command 'get ' packages{i} ';'];
 	end
 	command=[command '''  pfe22.nas.nasa.gov'];
@@ -39,9 +35,8 @@
 
 	%check bbftp worked
 	for i=1:numel(packages),
-		if ~exist(['./' packages{i}]),
+		if ~exist(['./' packages{i}],'file'),
 			error('scpin error message: could not call scp on *nix system');
 		end
 	end
-
 end

Modified: issm/trunk/src/m/os/issmscpin.m
===================================================================
--- issm/trunk/src/m/os/issmscpin.m	2017-10-11 17:54:14 UTC (rev 22168)
+++ issm/trunk/src/m/os/issmscpin.m	2017-10-12 21:45:29 UTC (rev 22169)
@@ -9,15 +9,11 @@
 hostname=oshostname();
 
 %first be sure packages are not in the current directory, this could conflict with pscp on windows. 
-%get initial warning mode
-state=warning('query', 'all');
-%remove warnings in case the files do not exist
-warning off
 for i=1:numel(packages),
-	delete(packages{i});
+	if exist(packages{i},'file'),
+		delete(packages{i});
+	end
 end
-%back to initial warning state
-warning(state);
 
 %if hostname and host are the same, do a simple copy
 if strcmpi(hostname,host),
@@ -49,8 +45,7 @@
 		end
 
 	else
-		%just use standard unix scp
-		%string to copy multiple files using scp: 
+		%just use standard unix scp string to copy multiple files using scp: 
 		if numel(packages)==1,
 			string=packages{1};
 		else



More information about the issm-svn mailing list