From 9205731dcd635d94627149324c234718bff3d2e1 Mon Sep 17 00:00:00 2001 From: Robert Oostenveld Date: Fri, 17 Aug 2018 08:33:10 +0200 Subject: [PATCH] ENH - allow user specification of timeout --- utilities/private/ft_test_report.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utilities/private/ft_test_report.m b/utilities/private/ft_test_report.m index 5d56dddcc6..f678856a09 100644 --- a/utilities/private/ft_test_report.m +++ b/utilities/private/ft_test_report.m @@ -27,7 +27,7 @@ assert(isequal(command, 'report')); varargin = varargin(2:end); -optbeg = find(ismember(varargin, {'matlabversion', 'fieldtripversion', 'user', 'hostname', 'branch', 'arch', 'showdate', 'showid'})); +optbeg = find(ismember(varargin, {'matlabversion', 'fieldtripversion', 'user', 'hostname', 'branch', 'arch', 'showdate', 'showid', 'timeout'})); if ~isempty(optbeg) optarg = varargin(optbeg:end); varargin = varargin(1:optbeg-1); @@ -37,8 +37,9 @@ % varargin contains the file (or files) to test % optarg contains the command-specific options -showdate = ft_getopt(optarg, 'showdate', false); -showid = ft_getopt(optarg, 'showid', false); +showdate = ft_getopt(optarg, 'showdate', false); if ischar(showdate), showdate = istrue(showdate); end +showid = ft_getopt(optarg, 'showid', false); if ischar(showid), showid = istrue(showid); end +timeout = ft_getopt(optarg, 'timeout', 30); if ischar(timeout), timeout = str2double(timeout); end % construct the query string that will be passed in the URL query = '?'; @@ -50,7 +51,7 @@ end end -options = weboptions('ContentType', 'json', 'Timeout', 30); % this returns the result as MATLAB structure +options = weboptions('ContentType', 'json', 'Timeout', timeout); % this returns the result as MATLAB structure url = 'http://dashboard.fieldtriptoolbox.org/api/'; if isempty(varargin) @@ -73,10 +74,10 @@ result = renamefields(result, 'createDate', 'date'); % remove some of the fields -if ~istrue(showid) +if ~showid result = removefields(result, 'id'); end -if ~istrue(showdate) +if ~showdate result = removefields(result, 'date'); end