Announcement

Collapse
No announcement yet.

nsProcess, is there a way to exclude processes?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • nsProcess, is there a way to exclude processes?

    Hi!

    I recently added to one of the install scripts I made a call to nsProcess::KillProcess...

    I have a small problem though, the name of the process I want to kill and the name of the install program is the same.

    Now if it was a first release of this application I could make sure the names are different but we have been using those names for a while now and renaming them would be kind of a pain...

    Is it possible to exclude the current running process from the list of processes killed by nsProcess::KillProcess?

    Thank you and have a nice day!

    Nick

  • #2
    I don't think it supports this.

    Try the LockedList plug-in...
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      Hi Anders!

      Unfortunately the LockedList plugin prompt might confuse our users so I can't really go that way...

      I see that the FCT plug-in does a job similar to the nsProcess plugin but using the window name (which can be a partial one I believe) so if that plugin still works (it was made in 2005 apparently) and if the window name is different between the setup program and the actual program (I am pretty sure it is but I will have to check when I get back to work) I might be able to use this instead...

      Thank you and have a nice day!

      Nick

      Comment


      • #4
        I suppose there is room for improvement in the process management department.
        IntOp $PostCount $PostCount + 1

        Comment


        • #5
          Try https://nsis.sourceforge.io/PS_plug-in
          IntOp $PostCount $PostCount + 1

          Comment


          • #6
            Thank you very much Anders! This will works very nicely...

            I see that you edited your answer and put the information that was in it in wiki page and added some additional information.

            I had kinda guessed PS::Enum was used to set and call a callback function which is called to evaluate whether something should be done about a particular process but your added comments in the wiki made it pretty clear now...

            You had mentioned in your original reply that the current running process (the setup program) was not seen by those commands (or something like that) but the documentation in the wiki only mention this for PS::Enum now, is it still true for the other commands?

            By the way, if we do not use them, is popping results from the stack necessary? I guess it might eventually overflow, right?

            Thank you and have a nice day!

            Nick

            Comment


            • #7
              I think the installer is excluded from End/Kill as well if you kill it by name but I'm not excluding if you do it by PId IIRC. The installer is excluded because of the issue you mentioned and the full path is not always reliable. On 95/98/ME it should always work. On other systems there will be processes you don't have access to. There should never be false positives but if someone runs your app as System for example, StrCmp $2 "$InstDir\myapp.exe" will not find it.

              The FindProcDLL plug-in claims to handle short names/paths, I'm not currently doing any short name handling.

              Yes, you should pop. If not to inspect the result then pop just to free the memory. Not a big deal in most cases but can be trouble if you don't pop inside a loop or callback.
              IntOp $PostCount $PostCount + 1

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎