- Timestamp:
- Jan 4, 2019, 3:14:36 PM (6 years ago)
- Location:
- branches/1.7
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.7/gui/apps/execute.tcl
r6702 r6705 37 37 value -tool "" 38 38 value -status "" 39 value -stdOutput "" 40 value -stdError "" 39 41 value -output "" 40 42 value -cleanup no … … 101 103 set TaskObj [Rappture::Task ::#auto $toolobj $installdir] 102 104 } 103 set LogFid "" 105 set LogStdoutFid "" 106 set LogStderrFid "" 104 107 105 108 # Define some things that we need for logging status... 106 109 # ---------------------------------------------------------------------- 110 proc log_error {message} { 111 global LogStderrFid 112 113 if {$LogStderrFid ne ""} { 114 puts -nonewline $LogStderrFid $message 115 } 116 } 117 107 118 proc log_output {message} { 108 global LogFid 109 110 if {$LogFid ne ""} { 111 # 112 # Scan through and pick out any =RAPPTURE-PROGRESS=> messages. 113 # 114 set percent "" 115 while {[regexp -indices \ 116 {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \ 117 match percent mesg]} { 118 119 foreach {i0 i1} $percent break 120 set percent [string range $message $i0 $i1] 121 122 foreach {i0 i1} $mesg break 123 set mesg [string range $message $i0 $i1] 124 125 foreach {i0 i1} $match break 126 set message [string replace $message $i0 $i1] 127 } 128 if {$percent ne ""} { 129 # report the last percent progress found 130 log_append progress "$percent% - $mesg" 119 global LogStdoutFid 120 121 if {$LogStdoutFid ne ""} { 122 if {$LogStdoutFid eq "stdout"} { 123 puts -nonewline $LogStdoutFid $message 124 flush $LogStdoutFid 125 } else { 126 # 127 # Scan through and pick out any =RAPPTURE-PROGRESS=> messages. 128 # 129 set percent "" 130 while {[regexp -indices \ 131 {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \ 132 match percent mesg]} { 133 134 foreach {i0 i1} $percent break 135 set percent [string range $message $i0 $i1] 136 137 foreach {i0 i1} $mesg break 138 set mesg [string range $message $i0 $i1] 139 140 foreach {i0 i1} $match break 141 set message [string replace $message $i0 $i1] 142 } 143 if {$percent ne ""} { 144 # report the last percent progress found 145 log_append progress "$percent% - $mesg" 146 } 131 147 } 132 148 } … … 135 151 # Actually write to the log file 136 152 proc log_append {level message} { 137 global Log Fid138 139 if {$Log Fid ne ""} {153 global LogStdoutFid 154 155 if {$LogStdoutFid ne ""} { 140 156 set date [clock format [clock seconds] -format {%Y-%m-%dT%H:%M:%S%z}] 141 157 set host [info hostname] 142 puts $Log Fid "$date $host rappture [pid] \[$level\] $message"143 flush $Log Fid158 puts $LogStdoutFid "$date $host rappture [pid] \[$level\] $message" 159 flush $LogStdoutFid 144 160 } 145 161 } … … 156 172 # Apply effects of all other command line options 157 173 # ---------------------------------------------------------------------- 174 if {$params(-stdOutput) ne ""} { 175 if {$params(-stdOutput) eq "@stdout"} { 176 set LogStdoutFid "stdout" 177 } else { 178 set LogStdoutFid [open $params(-stdOutput) w] 179 } 180 lappend args -stdout log_output 181 } 182 if {$params(-stdError) ne ""} { 183 if {$params(-stdError) eq "@stderr"} { 184 set LogStderrFid "stderr" 185 } else { 186 set LogStderrFid [open $params(-stdError) w] 187 } 188 lappend args -stderr log_error 189 } 190 158 191 if {$params(-status) ne ""} { 159 set LogFid [open $params(-status) w] 160 $TaskObj configure -logger {log_append status} -jobstats log_stats 192 if {$params(-status) ne "@default"} { 193 if {$LogStdoutFid eq ""} { 194 set LogStdoutFid [open $params(-status) w] 195 } 196 $TaskObj configure -logger {log_append status} -jobstats log_stats 197 } 161 198 } 162 199 … … 182 219 183 220 if {$params(-status) ne ""} { 184 # recording status? then look through output for progress messages 185 lappend args -output log_output 221 if {$params(-status) ne "@default"} { 222 # recording status? then look through output for progress messages 223 lappend args -output log_output 224 } 186 225 } 187 226 … … 222 261 } 223 262 224 log_append status "exit $status" 263 if {$params(-status) ne ""} { 264 if {$params(-status) ne "@default"} { 265 log_append status "exit $status" 266 } 267 } 225 268 exit $status -
branches/1.7/gui/apps/launcher.tcl
r6700 r6705 29 29 set loadlist "" 30 30 set toolxml "" 31 set stdOutput "" 32 set stdError "" 33 set status "rappture.status" 31 34 32 35 # ---------------------------------------------------------------------- … … 191 194 set argv [lrange $argv 1 end] 192 195 } 196 -status { 197 set status [lindex $argv 0] 198 set argv [lrange $argv 1 end] 199 } 200 -stdOutput { 201 set stdOutput [lindex $argv 0] 202 set argv [lrange $argv 1 end] 203 } 204 -stdError { 205 set stdError [lindex $argv 0] 206 set argv [lrange $argv 1 end] 207 } 193 208 default { 194 209 puts stderr "usage:" … … 244 259 # report status, clean up, and save output to data/results. 245 260 # This helps the web services interface do its thing. 246 set alist [list \ 247 -output @default \ 248 -status rappture.status \ 249 -cleanup yes \ 250 -xmlSource toolParameters] 261 set alist [list -output @default \ 262 -status $status \ 263 -stdOutput $stdOutput \ 264 -stdError $stdError \ 265 -cleanup yes \ 266 -xmlSource toolParameters] 251 267 } 252 268 "" - "-input" { -
branches/1.7/gui/scripts/analyzer.tcl
r6474 r6705 74 74 protected method _fixNotebook {} 75 75 protected method _simState {state args} 76 protected method _simLogError {message} 77 protected method _simLogOutput {message} 76 78 protected method _simOutput {message} 77 79 protected method _resultTooltip {} … … 461 463 pack forget $itk_component(progress) 462 464 lappend args -output [itcl::code $this _simOutput] 465 lappend args -stderr [itcl::code $this _simLogError] 466 # lappend args -stdout [itcl::code $this _simLogOutput] 463 467 464 468 _simState off … … 1112 1116 } 1113 1117 1118 itcl::body Rappture::Analyzer::_simLogError {message} { 1119 puts -nonewline stderr $message 1120 } 1121 1122 itcl::body Rappture::Analyzer::_simLogOutput {message} { 1123 puts -nonewline stdout $message 1124 flush stdout 1125 } 1126 1114 1127 # ---------------------------------------------------------------------- 1115 1128 # USAGE: _simOutput <message> -
branches/1.7/lang/tcl/scripts/result.tcl
r3728 r6705 65 65 66 66 if {$status == 0} { 67 puts "=RAPPTURE-RUN=>$oname" 67 set fileName [file join [pwd] $oname] 68 puts "=RAPPTURE-RUN=>$fileName" 68 69 } 69 70 } -
branches/1.7/lang/tcl/scripts/task.tcl
r6702 r6705 26 26 private method GetDriverFile {} 27 27 private method GetSignal { signal } 28 private method GetCacheHelperCommand { driverFile } 28 29 private method GetSimulationCommand { driverFile } 29 30 private method GetUQErrors {} … … 31 32 private method GetUQTemplateFile {} 32 33 private method IsCacheable {} 34 private method IsCacheHelperEligible {} 33 35 private method LogCachedSimulationUsage {} 34 36 private method LogSimulationUsage {} … … 54 56 public method save {xmlobj {name ""}} 55 57 58 protected method OnError {data} 56 59 protected method OnOutput {data} 57 60 protected method Log {args} … … 63 66 private variable _origxml "" ;# copy of original XML (for reset) 64 67 private variable _installdir "" ;# installation directory for this tool 68 private variable _errorcb "" ;# callback for tool error 65 69 private variable _outputcb "" ;# callback for tool output 66 70 private common jobnum 0 ;# counter for unique job number … … 73 77 74 78 public common _resources 75 public proc setAppName {name} { set _resources(-appname) $name } 76 public proc setHubName {name} { set _resources(-hubname) $name } 77 public proc setHubURL {name} { set _resources(-huburl) $name } 78 public proc setSession {name} { set _resources(-session) $name } 79 public proc setJobPrt {name} { set _resources(-jobprotocol) $name } 80 public proc setResultDir {name} { set _resources(-resultdir) $name } 81 public proc setCacheHosts {name} { set _resources(-cachehosts) $name } 79 public proc setAppName {name} { set _resources(-appname) $name } 80 public proc setHubName {name} { set _resources(-hubname) $name } 81 public proc setHubURL {name} { set _resources(-huburl) $name } 82 public proc setSession {name} { set _resources(-session) $name } 83 public proc setJobPrt {name} { set _resources(-jobprotocol) $name } 84 public proc setResultDir {name} { set _resources(-resultdir) $name } 85 public proc setCacheHosts {name} { set _resources(-cachehosts) $name } 86 public proc setCacheUser {name} { set _resources(-cacheuser) $name } 87 public proc setCacheWriteHost {name} { set _resources(-cachewritehost) $name } 82 88 83 89 # default method for -jobstats control … … 95 101 job_protocol Rappture::Task::setJobPrt \ 96 102 results_directory Rappture::Task::setResultDir \ 97 cache_hosts Rappture::Task::setCacheHosts 103 cache_hosts Rappture::Task::setCacheHosts \ 104 cache_user Rappture::Task::setCacheUser \ 105 cache_write_host Rappture::Task::setCacheWriteHost 98 106 } 99 107 … … 208 216 209 217 # if there are any args, use them to override parameters 218 set _errorcb "" 210 219 set _outputcb "" 211 220 set _uq(type) "" … … 214 223 set _uq(paramsFile) "" 215 224 foreach {path val} $args { 216 if {$path == "- output"} {225 if {$path == "-stdout"} { 217 226 set _outputcb $val 227 } elseif {$path == "-stderr"} { 228 set _errorcb $val 218 229 } elseif {$path == "-uq_type"} { 219 230 set _uq(type) $val 220 231 } elseif {$path == "-uq_args"} { 221 232 set _uq(args) $val 222 } else {233 } elseif {$path != "-output"} { 223 234 $_xmlobj put $path.current $val 235 } 236 } 237 foreach {path val} $args { 238 if {$path == "-output"} { 239 if {$_outputcb == ""} { 240 set _outputcb $val 241 } 224 242 } 225 243 } … … 238 256 239 257 SetCpuResourceLimit 258 259 set helperEligible [IsCacheHelperEligible] 260 240 261 set driverFile [GetDriverFile] 241 262 set cached 0 … … 244 265 set cached [CheckForCachedRunFile $driverFile] 245 266 } ]" 246 puts stderr "checking cache =$cached"267 puts stderr "checking cached=$cached" 247 268 } 248 269 if { !$cached } { … … 250 271 set _uq(tFile) [GetUQTemplateFile] 251 272 } 273 global env 252 274 if { $_uq(type) == "" } { 253 set cmd [GetSimulationCommand $driverFile] 254 global env 275 if { $helperEligible } { 276 set cmd [GetCacheHelperCommand $driverFile] 277 } else { 278 set cmd [GetSimulationCommand $driverFile] 279 } 255 280 set ::env(RAPPTURE_UQ) False 256 281 } else { 257 282 set cmd [GetUQSimulationCommand $driverFile] 258 global env259 283 set ::env(RAPPTURE_UQ) True 260 284 } … … 417 441 # use the runfile name generated by the last run 418 442 if {$_job(runfile) ne ""} { 419 set filename [file join $rdir $_job(runfile)]443 set filename [file join $rdir [file tail $_job(runfile)]] 420 444 } else { 421 445 set filename [file join $rdir run.xml] … … 456 480 if {[string length $_outputcb] > 0} { 457 481 uplevel #0 $_outputcb [list $data] 482 } 483 } 484 485 # ---------------------------------------------------------------------- 486 # USAGE: OnError <data> 487 # 488 # Used internally to send each bit of error <data> coming from the 489 # tool onto the caller, so the user can see progress. 490 # ---------------------------------------------------------------------- 491 itcl::body Rappture::Task::OnError {data} { 492 if {[string length $_errorcb] > 0} { 493 uplevel #0 $_errorcb [list $data] 458 494 } 459 495 } … … 504 540 set state [$_xmlobj get "tool.cache"] 505 541 } 506 puts stderr "cache tag is \"$state\"" 507 if { $state == "" || ![string is boolean $state] } { 542 if { $state ne "" } { 543 puts stderr "cache tag is \"$state\"" 544 } 545 if { $state eq "" || ![string is boolean $state] } { 508 546 return 1; # Default is to allow caching. 509 547 } 510 548 return $state 549 } 550 551 itcl::body Rappture::Task::IsCacheHelperEligible {} { 552 global env 553 if { ![info exists env(IONHELPER_ALLOWED)] } { 554 set helperEligible 0 555 } else { 556 if { $env(IONHELPER_ALLOWED) ne "1" } { 557 set helperEligible 0 558 } else { 559 if { $_uq(type) == "" } { 560 # puts stderr "cache_user exists = [info exists _resources(-cacheuser)]" 561 # puts stderr "cache_write_host exists = [info exists _resources(-cachewritehost)]" 562 if { ![info exists _resources(-cacheuser)] || ![info exists _resources(-cachewritehost)] } { 563 set helperEligible 0 564 } else { 565 if { ![info exists env(USER)] } { 566 set helperEligible 0 567 } else { 568 # puts stderr "env(USER) = $env(USER)" 569 # puts stderr "cache_user = $_resources(-cacheuser)" 570 if { $env(USER) eq $_resources(-cacheuser) } { 571 set helperEligible 0 572 } else { 573 set toolId [$_xmlobj get tool.id] 574 set toolVers [$_xmlobj get tool.version.application.revision] 575 set toolDir [$_xmlobj get tool.version.application.directory(top)] 576 set verifyDir [file join / apps ${toolId} r${toolVers}] 577 # puts stderr "toolDir = $toolDir" 578 # puts stderr "verifyDir = $verifyDir" 579 if { $toolDir eq $verifyDir } { 580 if { [ catch { file readlink [file join / apps ${toolId} current] } currentVers ] != 0 } { 581 set helperEligible 0 582 } else { 583 # puts stderr "currentVers = $currentVers" 584 if { "r$toolVers" eq $currentVers } { 585 set helperEligible 1 586 } else { 587 set helperEligible 0 588 } 589 } 590 } else { 591 set helperEligible 0 592 } 593 } 594 } 595 } 596 } else { 597 set helperEligible 0 598 } 599 } 600 } 601 # puts stderr "helperEligible = $helperEligible" 602 603 return $helperEligible 511 604 } 512 605 … … 585 678 } 586 679 680 itcl::body Rappture::Task::GetCacheHelperCommand { driverFile } { 681 set cmd "" 682 set helperDriverDir [file join / var ion drivers] 683 if { [file exists $helperDriverDir] } { 684 set cacheHelperCommand [file join / apps bin iondrive] 685 if { [file exists $cacheHelperCommand] } { 686 file copy -force $driverFile $helperDriverDir 687 set cmd $cacheHelperCommand 688 } 689 } 690 691 return $cmd 692 } 693 587 694 itcl::body Rappture::Task::GetCommand { } { 588 695 set cmd [$_xmlobj get tool.command] … … 681 788 -keepnewline yes \ 682 789 -killsignal SIGTERM \ 790 -onerror [list [itcl::code $this OnError]] \ 683 791 -onoutput [list [itcl::code $this OnOutput]] \ 684 792 -output [list [itcl::scope _job(stdout)]] \ … … 749 857 # Need to save job info? then invoke the callback 750 858 if { [string length $jobstats] > 0} { 751 lappend args \ 752 "job" [incr jobnum] \ 753 "event" $simulation \ 754 "start" $times(start) \ 755 "walltime" $times(walltime) \ 756 "cputime" $times(cputime) \ 757 "status" $_job(exitcode) 859 lappend args "job" [incr jobnum] \ 860 "event" $simulation \ 861 "start" $times(start) \ 862 "walltime" $times(walltime) \ 863 "cputime" $times(cputime) \ 864 "status" $_job(exitcode) 758 865 uplevel #0 $jobstats $args 759 866 } … … 852 959 # [click] messages go here 853 960 if { [string length $jobstats] > 0} { 854 lappend args \ 855 "job" [incr jobnum] \ 856 "event" "\[click\]" \ 857 "start" $times(start) \ 858 "walltime" 0 \ 859 "cputime" 0 \ 860 "status" 0 861 uplevel #0 $jobstats $args 961 set recordJobstats 1 962 if { [info exists _resources(-cacheuser)] } { 963 global env 964 if { $env(USER) eq $_resources(-cacheuser) } { 965 set recordJobstats 0 966 } 967 } 968 if { $recordJobstats } { 969 lappend args "job" [incr jobnum] \ 970 "event" "\[click\]" \ 971 "start" $times(start) \ 972 "walltime" 0 \ 973 "cputime" 0 \ 974 "status" 0 975 uplevel #0 $jobstats $args 976 } 862 977 } 863 978 … … 894 1009 set data(start) [expr { $times(start) + $data(start) }] 895 1010 1011 # puts stderr "event subsimulation start = $data(start)" 1012 896 1013 set details "" 897 1014 foreach key {job event start walltime cputime status} { … … 933 1050 934 1051 if { [string length $jobstats] > 0} { 935 lappend args \ 936 "job" [incr jobnum] \ 937 "event" "\[click-uq\]" \ 938 "start" $times(start) \ 939 "walltime" 0 \ 940 "cputime" 0 \ 941 "status" 0 1052 lappend args "job" [incr jobnum] \ 1053 "event" "\[click-uq\]" \ 1054 "start" $times(start) \ 1055 "walltime" 0 \ 1056 "cputime" 0 \ 1057 "status" 0 942 1058 uplevel #0 $jobstats $args 943 1059 } … … 960 1076 error "Can't create rappture library: $xmlobj" 961 1077 } 962 # Get the session from runfile963 set session [$xmlobj get "output.session"]964 if { [catch {exec submit --cache $session} result] != 0 } {965 puts stderr "submit --cache failed: $result"966 }967 1078 set _job(xmlobj) $xmlobj 968 1079 } … … 981 1092 http::geturl $url -query $query -timeout 6000 -binary yes 982 1093 } token] != 0 } { 983 puts stderr "error performing cache query: token=$token"1094 puts stderr "error performing cache query: driverFile=$driverFile url=$url token=$token" 984 1095 return 0 985 1096 } … … 990 1101 # puts stderr "meta = [::http::meta $token]" 991 1102 1103 set squid "" 992 1104 foreach {key value} [::http::meta $token] { 993 1105 set headers([string tolower $key]) $value 994 1106 if { [string tolower $key] == "etag" } { 995 set guid $value1107 set squid $value 996 1108 } 997 1109 } 998 1110 # puts stderr "SQUID = $headers(etag)" 999 # puts stderr "SQUID = $guid" 1111 # puts stderr "SQUID = $squid" 1112 if { [resources -jobprotocol] == "submit" } { 1113 if { $squid != "" } { 1114 # If the code is 200, we'll assume it's a cache hit. 1115 if { [http::ncode $token] == 200} { 1116 if { [catch {exec submit --cacheHit $squid} result] != 0 } { 1117 puts stderr "submit --cacheHit $squid failed: $result" 1118 } 1119 # puts stderr "submit --cacheHit $squid" 1120 } else { 1121 if { [catch {exec submit --cacheMiss $squid} result] != 0 } { 1122 puts stderr "submit --cacheMiss $squid failed: $result" 1123 } 1124 # puts stderr "submit --cacheMiss $squid" 1125 } 1126 } else { 1127 puts stderr "cache squid could not be determined." 1128 } 1129 } 1000 1130 1001 1131 # If the code isn't 200, we'll assume it's a cache miss. -
branches/1.7/src/core/RpLibrary.cc
r6313 r6705 28 28 #include <iterator> 29 29 #include <cctype> 30 #include <limits.h> 31 #include <unistd.h> 30 32 31 33 #ifdef _POSIX_SOURCE … … 2048 2050 } 2049 2051 if ((compress == RPLIB_COMPRESS) || 2050 (Rappture::encoding::isBinary(fileBuf.bytes(), fileBuf.size()))) { 2052 (Rappture::encoding::isBinary(fileBuf.bytes(), fileBuf.size()))) { 2051 2053 putData(path, fileBuf.bytes(), fileBuf.size(), append); 2052 2054 } else { … … 2227 2229 struct tm* timeinfo; 2228 2230 std::stringstream outputFile; 2231 char currentWorkingDirectory[PATH_MAX+1]; 2232 char *cwd; 2229 2233 std::string timestamp; 2230 2234 std::string username; … … 2233 2237 2234 2238 if (this->root == NULL) { 2235 return;/* No tree available */2236 } 2237 2238 t = time(NULL); 2239 2239 return; /* No tree available */ 2240 } 2241 2242 t = time(NULL); /* This is presumably the time the 2243 * simulation finished. */ 2240 2244 #ifdef HAVE_GETTIMEOFDAY 2241 2245 /* If the posix function gettimeofday is available, use it to produce … … 2247 2251 outputFile << "run" << (int)t << ".xml"; 2248 2252 #endif 2253 // get current working directory 2254 cwd = getcwd(currentWorkingDirectory,PATH_MAX); 2255 2249 2256 file.open(outputFile.str().c_str(),std::ios::out); 2250 2257 … … 2253 2260 put("tool.version.rappture.revision", SVN_VERSION); 2254 2261 put("tool.version.rappture.modified", 2255 2262 "$LastChangedDate$"); 2256 2263 if ( "" == get("tool.version.rappture.language") ) { 2257 2264 put("tool.version.rappture.language","c++"); 2258 2265 } 2259 2266 // generate a timestamp for the run file … … 2270 2277 user = getenv("USERNAME"); 2271 2278 if (user != NULL) { 2272 2279 username = std::string(user); 2273 2280 } else { 2274 2275 2276 2277 2281 user = getenv("LOGNAME"); 2282 if (user != NULL) { 2283 username = std::string(user); 2284 } 2278 2285 } 2279 2286 #else … … 2281 2288 user = getenv("USER"); 2282 2289 if (user != NULL) { 2283 2290 username = std::string(user); 2284 2291 } else { 2285 2286 2287 2288 2292 user = getenv("LOGNAME"); 2293 if (user != NULL) { 2294 username = std::string(user); 2295 } 2289 2296 } 2290 2297 #endif … … 2297 2304 2298 2305 if ( file.is_open() ) { 2299 xmlText = xml(); 2300 if (!xmlText.empty()) { 2301 file << xmlText; 2302 } 2303 // check to make sure there were no 2304 // errors while writing the run.xml file. 2305 if ( (!file.good()) 2306 || ((long)xmlText.length() != ((long)file.tellp()-(long)1)) 2307 ) { 2308 status.error("Error while writing run file"); 2309 status.addContext("RpLibrary::result()"); 2310 } 2311 file.close(); 2306 xmlText = xml(); 2307 if (!xmlText.empty()) { 2308 file << xmlText; 2309 } 2310 // check to make sure there were no 2311 // errors while writing the run.xml file. 2312 if ( (!file.good()) || ((long)xmlText.length() != ((long)file.tellp()-(long)1))) { 2313 status.error("Error while writing run file"); 2314 status.addContext("RpLibrary::result()"); 2315 } 2316 file.close(); 2312 2317 } else { 2313 status.error("Error while opening run file"); 2314 status.addContext("RpLibrary::result()"); 2315 } 2316 std::cout << "=RAPPTURE-RUN=>" << outputFile.str() << std::endl; 2318 status.error("Error while opening run file"); 2319 status.addContext("RpLibrary::result()"); 2320 } 2321 if ( cwd != NULL ) { 2322 std::string currentDirectory(currentWorkingDirectory); 2323 std::cout << "=RAPPTURE-RUN=>" << outputFile.str() << "/" << currentDirectory << std::endl; 2324 } else { 2325 std::cout << "=RAPPTURE-RUN=>" << outputFile.str() << std::endl; 2326 } 2317 2327 } 2318 2328 -
branches/1.7/src/core/RpResult.cc
r5679 r6705 19 19 #include <RpLibrary.h> 20 20 #include <errno.h> 21 #include <limits.h> 22 #include <unistd.h> 21 23 22 24 void … … 24 26 { 25 27 char outputFile[100]; 28 char currentWorkingDirectory[PATH_MAX+1]; 29 char *cwd; 26 30 std::string xtext; 27 31 FILE* fp; … … 29 33 30 34 xtext = lib->xml(); 35 36 // get current working directory 37 cwd = getcwd(currentWorkingDirectory,PATH_MAX); 31 38 32 39 // create output filename … … 42 49 if (fsize != (int)xtext.length()) { 43 50 fprintf(stderr, "short write: can't save results: %s\n", 44 51 strerror(errno)); 45 52 fclose(fp); 46 53 return; … … 48 55 fclose(fp); 49 56 // tell Rappture the file name 50 printf("=RAPPTURE-RUN=>%s\n", outputFile); 57 if (cwd != NULL) { 58 printf("=RAPPTURE-RUN=>%s/%s\n", currentWorkingDirectory, outputFile); 59 } else { 60 printf("=RAPPTURE-RUN=>%s\n", outputFile); 61 } 51 62 }
Note: See TracChangeset
for help on using the changeset viewer.