Coder Social home page Coder Social logo

Comments (14)

d0vgan avatar d0vgan commented on September 26, 2024 2

Well, I think the old behavior needs to be preserved by default - to be consistent with the standard command prompt.
And the new one, where the process tree is killed, will be enabled e.g. by npe_console j+.

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024 1

or it can be solved by using npp_run:

npp_run $(CMD) start $(NPP_DIRECTORY)\change.log

or simply

npp_run $(NPP_DIRECTORY)\change.log

from nppexec.

vinsworldcom avatar vinsworldcom commented on September 26, 2024 1

YES - you're right, just tested.

Thank you @badrelmers and @d0vgan for the help. I LOVE this plugin - evidence my 2850+ line npes_saved.txt!

from nppexec.

d0vgan avatar d0vgan commented on September 26, 2024 1

Please try the latest version NppExec20220203_dll here:
https://sourceforge.net/projects/npp-plugins/files/NppExec/NppExec%20Plugin%20(dev)/

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024 1

NPE_CONSOLE j+/j- works perfectly
this is great, thank you so much d0vgan

from nppexec.

d0vgan avatar d0vgan commented on September 26, 2024

Heck, it contradicts with this! -- #60
In particular, it contradicts with this approach:
https://stackoverflow.com/questions/24012773/c-winapi-how-to-kill-child-processes-when-the-calling-parent-process-is-for/24020820
To sum up, we most likely want this behavior in case of a console child process running from a root process; and we most likely do not want it in case of a GUI child process running from a root process.
How to handle both cases? I don't know...

from nppexec.

vinsworldcom avatar vinsworldcom commented on September 26, 2024

from nppexec.

vinsworldcom avatar vinsworldcom commented on September 26, 2024

Happy to test when available.

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024

This bug have nothing to do with ctrl-c behavior described here #60
it happens in the default dll of 20220128 dev build
and it is caused by the new feature of killing the childs
in fact notepad open then close quickly like that:
you run

$(CMD) start $(NPP_DIRECTORY)\change.log

then cmd exit, then Nppexec will kill notepad thanks to the new feature (killing the childs)

so this is a feature not a bug I think.

it can be solved easily by adding /wait flag so cmd do no exit:

$(CMD) start /wait $(NPP_DIRECTORY)\change.log

from nppexec.

vinsworldcom avatar vinsworldcom commented on September 26, 2024

Indeed, the /wait to the start command seems to fix it - in some cases.

I have a script:

::relaunch
NPP_CONSOLE disable
NPP_EXEC date
NPP_EXEC time
NPP_CONSOLE enable
SET LOCAL TIMESTAMP = $(DATE)$(TIME)
SET LOCAL TEMPFILE = "$(SYS.TEMP)\session_$(TIMESTAMP).nps"
NPP_EXEC save session $(TEMPFILE)
$(CMD) start $(POWERSHELL) "Start-Sleep 3; $(NPP_DIRECTORY)\notepad++.exe -openSession $(TEMPFILE)"
// $(CMD) start powershell -NoProfile -Command "Read-Host -Prompt 'Press Enter to launch Notepad++'; $(NPP_DIRECTORY)\notepad++.exe -openSession $(NPP_DIRECTORY)\session.xml"
NPP_EXEC exit

which breaks. I need to launch the PowerShell and let it continue running while the NppExec script continues to run and exists Notepad++ , which the PowerShell re-opens. This script works find in NppExec 0.7.1, but fails in the new version and adding the /wait doesn't help as it waits for the powershell to complete and then continues - which exits Notepad++ defeating the purpose.

I like the idea above of :

"old behavior needs to be preserved by default - to be consistent with the standard command prompt.
And the new one, where the process tree is killed, will be enabled e.g. by npe_console j+."

Cheers.

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024

@d0vgan

Well, I think the old behavior needs to be preserved by default - to be consistent with the standard command prompt.
And the new one, where the process tree is killed, will be enabled e.g. by npe_console j+

you are right, new comers will think that NppExec do not work, the feature of killing childs should be enabled when needed not by default to be consistent with the standard command prompt as you said.

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024

@vinsworldcom
your case can be solved by using npp_run $(POWERSHELL)... instead of $(CMD) start $(POWERSHELL)...

npp_run is not affected by the new feature (killing childs)

from nppexec.

vinsworldcom avatar vinsworldcom commented on September 26, 2024

@badrelmers , @d0vgan took some time yesterday to go through my large npes_saved.txt and it seems there are many places where I can replace cmd.exe /d /c => $(CMD) for NPP_RUN ... and things work as expected. I use the $(CMD) to run "Batch" commands like if exist ..., for /f %i in ... but was also using it to "launch" applications like $(CMD) explorer.exe ... which it seems are better suited to NPP_RUN ....

Thanks for your patience and help - I use this plugin everyday I'm in Notepad++ to automate so many tasks yet I still seem to have only scratched the surface of understanding what's possible or the best way to implement things.

Cheers.

from nppexec.

badrelmers avatar badrelmers commented on September 26, 2024

yes d0vgan really made a good work, he made the beautiful Notepad++ to become something more beautiful. thanks to him and his time and nice work

from nppexec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.