help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CWD of job-monitored subprocess


From: Greg Wooledge
Subject: Re: CWD of job-monitored subprocess
Date: Sun, 23 Jan 2022 09:10:58 -0500

On Sun, Jan 23, 2022 at 09:21:13AM +0100, Alex fxmbsw7 Ratchev wrote:
> i am not sure at all of what you write, and your overcomplicated codes i
> dont read

Irony senses tingling.

> but maybe if u handle the args absolutely in the beginning
> 
> play file1 file2
> 
> then play does
> file=$PWD/$1 for example
> 
> cd /
> 
> handle "$file" ( absolute path )

I took a short look at the OP's code, but as you said, it's rather
difficult to read.  I didn't feel like I had a solid enough understanding
of the tools they're using to know why they were doing things the way
they were.

That said, I think I understand the basic problem: they've got some sort
of "automount" type of situation.  By which I mean, a resource (file/dir)
is held open while in use, and once it's no longer in use, it's supposed
to be released.  But it's not being released, because something is holding
it open longer than they expected.

The main issue that I saw in the OP's code is that their "handler" (audio
player) isn't a single process.  It's a shell pipeline.  They're doing
something like

  cat audiofile | player

only it's wrapped in layers of "eval".  Therefore, instead to just having
one player process, they've got a filter program (or maybe just cat) that's
actually holding the file open *and* they've got the shell that's waiting
on the pipeline to terminate, which is also holding the directory open.

I would suggest unraveling all of that nonsense first.

But even if they remove all of the filtering and eval nonsense, the issue
still remains that the *player* is going to be holding the *file* open,
which is going to prevent the releasing of the mount point, as long as
the audio file is being played.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]