Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"child process exited abnormally"

Status
Not open for further replies.

clandestin

IS-IT--Management
Sep 20, 2005
4
0
0
DE
Hello

I have a curious problem with exec. I use this command to find out the status of a process. But even if the same command gives the right output when executed from command-line, using it with exec gives this: child process exited abnormally

here is the line:

catch {exec ps aux | grep P00data | grep -v grep} result

and the "result" variable is: child process exited abnormally

I've been trying this alternative with no success:

catch {exec ps aux |& grep P00data |& grep -v grep} result

I expect that when my process ist'n running, the value of "result" to be 0.

Any suggestions?

Thank you
 
I met this problem too and have solve it for myself by calling application I needed in separate thread. To avoid error message (it's not an error, it's warning!), I redirect output to special output pipe.

proc ::myProc {} {
package require Thread

# Create thread for run 'Build Table' function
set ::testing::listener [thread::create {
thread::wait
}]

# Send directive to process
thread::send -async $::testing::listener [set ::testing::procId [SendCmd $command]]
while {![info exists ::testing::retc]} {
vwait ::testing::retc
}
# '::testing::retcode' is a variable for store return code
# '::testing::procId' is a variable for store process id
}

## Procedure: SendCmd
proc ::SendCmd {directive} {
# Execute a command
#
# Procedure opens an input-output channel named 'pipe'
# and runs a directive. Directive (command) sends it's
# output data into named channel 'pipe' and after that
# data will be shown into program console 'ConsoleArea'
# with 'WriteLog' procedure.
# When the pipe is empty, it will be cloused

global upvar #0 ConsoleArea
if [catch {open "|$directive |& cat"} ::testing::pipe] {
ConsoleArea insert end $::testing::pipe\n
} else {
set pids [pid $::testing::pipe]
# redirecting output to pipe with special procedure
fileevent $::testing::pipe readable WriteLog
ConsoleArea see end
}
return $pids
}

proc ::WriteLog {} {
# Writes log into file and console
#
# Returns retc:
# 0 - Finish the test
# 1 - Exit from waiting cycle
# 2 - Continue printing the results
#
package require Thread
global upvar #0 ConsoleArea
# if pipe contains already nothing, close it and complete the process
if [info exists ::testing::pipe] {
if [eof $::testing::pipe] {
catch {
close $::testing::pipe ;# closing output pipe
set ::testing::pipe ""
}
CompleteProcess 0 ;# completing thread function call
} else {
# logging
gets $::testing::pipe line
# if my called program told me about finishing
if {$line eq "1"} {
set ::testing::retc 1
# if not, continue logging
} else {
ConsoleArea insert end $line\n
ConsoleArea see end
set ::testing::retc 2
}
}
}
return $::testing::retc
}

 
sevmaster,

I will try and understand your example and than make it work for me too.

I appreciate your answer.


Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top