Re: output error messages
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: Wed, 2 Jun 2010 08:22:15 -0700 (PDT)
On Jun 2, 5:15 pm, Dave <hende...@xxxxxxxxx> wrote:
Gang,
I'm still working on the same script from the post yesterday
(which had its previous problem resolved this morning). I'm issuing a
'mv' command via spawn but the script isn't throwing any errors,
however the file thats attempted to be moved is not moving either.
I'm sure there is an error message being displayed by the 'mv'
command, but I don't know how to access the message. I've tried using
'catch' and can display an error code, but not the message (as shown
below). Any help on being able to print the error message so I can
see (whether to screen or file) would greatly be appreciated.
catch { eval spawn -noecho $syntax } curr_result
send_user "error is: $curr_result\n";
NOTE: $syntax contains the command to execute and is passed into the
script via a parameter value. At present, I'm just trying something
simple like "mv a.txt b.txt" where a.txt doesn't exist so I can print
out the error message.
From what you wrote here and in the other thread, I don't see a goodreason to use Expect. Are there other considerations that would change
this impression ? Do you need to control interactive things like
telnet, ssh, ftp, rlogin ?
If not, just do it with vanilla tclsh.
Then you'll see that
catch {exec sh -c $syntax} curr_result
does retrieve the error.
Alternatively, you can tell Tcl to let the stderr of the commands flow
to the console unimpeded, and just get the binary success information:
set nok [catch {exec sh -c $syntax 2>@ stderr}]
-Alex
.
- Follow-Ups:
- Re: output error messages
- From: Dave
- Re: output error messages
- References:
- output error messages
- From: Dave
- output error messages
- Prev by Date: Xming X11 server and fullscreen mode
- Next by Date: teabags, teacups and black kettles.
- Previous by thread: output error messages
- Next by thread: Re: output error messages
- Index(es):
Relevant Pages
|