1

Is there a way to mute or remove error messages from a Clearcase command such as mklabel? I'd like to suppress error messages from the mklabel command if possible.

rafafan2010
  • 1,559
  • 2
  • 14
  • 23
  • You could just redirect stderr output to `/dev/null` ? – Paul R Jun 24 '14 at 18:29
  • I just tried that, and it worked to a certain degree. I'm using the Clearcase plugin for Jenkins, and the errors from my `mklabel` command are the only things causing the job to fail. I know the `mklabel` command is labeling everything I need, but Jenkins continues to fail the job. I was hoping that the redirection would solve that issue, but it doesn't. Jenkins still fails the job. – rafafan2010 Jun 24 '14 at 18:57
  • @rafafan2010 what error message does the mklabel generates in your Jenkins job? – VonC Jun 24 '14 at 19:03
  • Several errors in this form: `cleartool: Error: Unable to access "/view/RPL_CSL_Main/vob/ms2_rpl/lost+found": No such file or directory.` I have deliberately excluded elements using a `-none` selection rule, and I don't want those elements to be labeled. Yet, the command still tries to label them. I think that generates the error which causes Jenkins to fail the job. – rafafan2010 Jun 24 '14 at 19:09
  • @rafafan2010 can you try (as in http://stackoverflow.com/a/8794738/6309) a `element /myVob/lost+found/... -none`, keeping `lost+found`, but excluding its content? (`/...`). For you: `element /vobs/ms2_rpl/lost+found/... -none`. I suppose the `/vob` was a type: it should be `/vobs/xxx`. – VonC Jun 24 '14 at 19:12
  • It didn't do anything when I changed the config spec and ran the command again. By the way, I'm doing this in a Dynamic View, in case that changes anything. – rafafan2010 Jun 24 '14 at 19:38
  • @rafafan2010 no, dynamic view is fine. Do you mean you get the exact same error message? and did you use `/vob` or `/vobs`? Was it a typo. – VonC Jun 24 '14 at 19:42

1 Answers1

0

The scripts you see in this thread (or this one, or in one of the ten best scripts) usually employ the same technique:

cleartool mklabel ... 2> /dev/null

In a perl script for instance:

my $cout = `cleartool desc $pn@@\/$lbtype 2>/dev/null` ;

This is part of cleartool output redirection techniques.

I prefer redirecting stderr in a file, that I can parse (after executing the command) to detect rare errors, while ignoring all the warning (like label already existing and moved).

But the main idea remains: for a cleartool mklabel, there is no -silent or -quiet option.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250