util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* flock(1) exit code (enhancement request)
@ 2012-05-29 11:45 Jan Kasprzak
  2012-06-05 11:46 ` Karel Zak
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kasprzak @ 2012-05-29 11:45 UTC (permalink / raw)
  To: util-linux

        Hello, util-linux developers!

I use flock(1) from util-linux in my scripts, and with --wait or --nonblock
I would like to be able to distinguish between the "conflicting lock exists"
and "-c <command> exited with code 1" states.

        Of course, I can always wrap the -c argument with something like
bash -c "<original_cmd_and_args> || exit 2" with yet another level of
quoting, but I think it is really ugly.

        This problem can be solved for example by mapping the exit code 1
of the -c command to something else. I.e. to add something like

        -m <number>
        --map-exit-code-1-to <number>

where the exit code of flock(1) would be <number>, iff the -c <command> exits
with code 1.

	The alternative would be to have user-settable exit code for
the "conflicting lock exists" failure.

	What do you think about it? If you agree with the above syntax,
I can of course post a patch to flock(1).

        Thanks,

-Yenya

-- 
| Jan "Yenya" Kasprzak  <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839      Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/    Journal: http://www.fi.muni.cz/~kas/blog/ |
Please don't top post and in particular don't attach entire digests to your
mail or we'll all soon be using bittorrent to read the list.     --Alan Cox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-15  9:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-29 11:45 flock(1) exit code (enhancement request) Jan Kasprzak
2012-06-05 11:46 ` Karel Zak
2012-06-05 14:08   ` H. Peter Anvin
2012-06-05 14:26   ` Jan Kasprzak
2012-06-05 14:26   ` [PATCH] flock: user-configurable exit code Jan "Yenya" Kasprzak
2012-06-15  9:15     ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).