GithubHelp home page GithubHelp logo

Comments (12)

genotrance avatar genotrance commented on August 16, 2024

So Px is actually an application that is designed to run in the background. It is compiled as a window-less app so there's no console window by default. If it were built as a console app, it would pop up a console window and sit there. Even if you hide that, it would pop up and then get hidden and isn't the best service app experience.

Given there's useful console output, I use the AttachConsole() method to write to a console if one exists. I've posted an updated test build that also binds to a Powershell parent console. Meanwhile, git-cmd uses cmd already so it works as is. Even if you run Px with your method, it should find the parent console and write to it since it recurses till it finds a console parent. If you run Px directly from Explorer though, it won't find a parent console and skip writing to stdout.

The behavior in Powershell isn't ideal but better than nothing.

That being said, can you please try out this new px.exe and let me know if it works with your shimed exe? I'm assuming you were running it in Powershell. If not, can you please run px with --debug to see what comes out in the log file?

from px.

ccbur avatar ccbur commented on August 16, 2024

Ah, I see. Sorry, I'm used to linux environments and I'm alway wondering about those kind of (windows) problems :)

Directly in Powershell works now, but not the shimed px.exe, neither from cmd.exe, nor powershell.exe. Debug log is

MainProcess: MainThread: 1519285657: attachConsole: No parent console to attach to

I changed the attachConsole()-Method to connect to the shimed px.exe, but
ctypes.windll.kernel32.AttachConsole()
just throws an error :-( And there is no cmd.exe or powershell.exe in thie hierarchie. It's just the shimed px.exe.

So no console output possible... I guess I have to live with that.

from px.

genotrance avatar genotrance commented on August 16, 2024

How are you running this shimed executable? If you are running it from Explorer or Start->run, there's no command console that's the owning parent. It would only work if you ran the shimed executable from a cmd or powershell console since Px would find it as it looked through the parent processes. What does the process hierarchy look like in Process Explorer?

Can you show me how to build/install via Chocolatey? I can try it out.

from px.

ccbur avatar ccbur commented on August 16, 2024

Yes, I'm running the shimed exe from cmd or powershell, but neither works.

Is there a way to send you my nupkg directly? Github is not accepting this file via the upload function. I tried to rename it to .zip, tried to rewrap it in a zip, tried every trick there might be, but Github is still not accepting this upload from me :-(

With the nupkg you just need to install Chocolatey (see install), reopen a cmd.exe or powershell.exe and then install the nupkg with

cd "c:\path_to_folder_with_pxnupkg"
choco install px -s "'.;https://chocolatey.org/api/v2/'"

After this the shimed px.exe should be in your path and the original should be here: C:\ProgramData\chocolatey\lib\px\tools\px-v0.3.0\

from px.

ccbur avatar ccbur commented on August 16, 2024

And here a screenshot from ProcessExplorer:

pxprocexp

As you can see, no cmd.exe in the hierarchy. But I started it from a running cmd.exe :-/

from px.

genotrance avatar genotrance commented on August 16, 2024

Could you send the spec file? I presume I can build the pkg without Visual Studio. If not, you could send it over @ https://send.firefox.com

from px.

ccbur avatar ccbur commented on August 16, 2024

Here the full nupkg based on the current pre-release:
https://send.firefox.com/download/25db50ec09/#Zigr3Q1D_7NhKy8BE4WOtg

You can build this with chocolatey directly via choco pack.

But I'm currently struggling with the latest pre-release. I'm not able to get any NTLM authentication any more... :-( Maybe it's Kerberos-related or I messed something up.

from px.

genotrance avatar genotrance commented on August 16, 2024

Can you also please send me the spec file? I presume that's what you need for choco pack? I'll try the pkg until then.

from px.

genotrance avatar genotrance commented on August 16, 2024

Okay, found the spec file once I installed, never mind.

from px.

genotrance avatar genotrance commented on August 16, 2024

So the shimgen process checks and generates a shim based on type of EXE. Since Px.exe is a GUI app, it generates a GUI shim and the default behavior for GUI shims is to exit once the app has been started. Because of this, Px no longer has a parent or a way to figure out which console it was run from.

Shims do have a --shimgen-waitforexit flag which allows them to wait until child is done. I ran px --shimgen-waitforexit --help and the output works as expected. I don't see a way for Chocolatey to setup a GUI shim with wait for exit set by default though.

I'm also wondering if wait for exit should be always true. If it is, you will always have a console popup even if you don't run from a console which was the whole reason for creating Px as a GUI app.

An option is to force Px to create a console if run with --foreground and to set --foreground if --help is specified or some such thing. Problem though will be that a separate console will popup with the help output and promptly exit too, never showing it's output.

I'm not sure what the solution is at this point since Px isn't really doing something standard - GUI app writing to parent console if one exists.

from px.

genotrance avatar genotrance commented on August 16, 2024

Assuming shimgen is updated as suggested here, Px will start working as expected. I'm not sure if we should keep this issue open though.

from px.

ccbur avatar ccbur commented on August 16, 2024

You're right. Let's hope for an improvement there.

I'll close this issue.

from px.

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.