fix(service): unable to capture output for command:exit status 2
kr-2003 opened this issue · comments
Description
After setting up the project and running this command on terminal
./dcr run --pkgpath ../samples/init_collaboration
I am getting the following error
ERRO[0013] err running event: unable to capture output for command:exit status 2
Error: err running service: err running event: unable to capture output for command:exit status 2
How are you planning to resolve on this issue?
Introducing few code changes
@kr-2003 Thanks for reporting this bug.You will find this function inside lib/utils/misc.go
. Please uncomment the log.Infof
line and tell me which cmds you are getting errors at. Then we can debug this further to understand the issue.
func RunCmd(cmd *exec.Cmd) (string, error) {
output, err := cmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("unable to capture output for command:%s", err)
}
//log.Infof("Output of cmd %s: %s", cmd.String(), output)
return string(output), err
}
@qascade After commenting and then running the same command again, the command is running successfully and the last thing it does is to write in /samples/init_collaboration/research_pkg/results.txt
We are running some External commands using threads by using os/exec pkg. What I want to know is which command is causing this issue. It may be cp
or ego
?
Currently its working fine but previously the last command before the error was cp
.
INFO[0000] copyfile from /<directory>/Projects/dcr/samples/init_collaboration/media_pkg/media_customers.csv to /<directory>/Projects/dcr/samples/init_collaboration/research_pkg/go_app/test2.csv
I think the issue arises if enclave.json
is not generated yet. If you run the command twice it will run fine. This is weird.