Comments (12)
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.
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.
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.
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.
And here a screenshot from ProcessExplorer:
As you can see, no cmd.exe in the hierarchy. But I started it from a running cmd.exe :-/
from px.
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.
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.
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.
Okay, found the spec file once I installed, never mind.
from px.
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.
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.
You're right. Let's hope for an improvement there.
I'll close this issue.
from px.
Related Issues (20)
- 0.7.0: [Errno 10054] An existing connection was forcibly closed by the remote host. HOT 3
- WSL v2 compatibility? HOT 3
- Successfully created EXE file is not executable. HOT 2
- [WinError10053] An established connection was aborted by the software in your host machine HOT 20
- After a few requests the proxy seems to go in a loop without serving more data HOT 2
- Debug output showsstrange characters and some requests don't seem to return. HOT 3
- import problem on macos pip install HOT 1
- Px Proxy Issue on Windows HOT 3
- "PROXY" prefix in web.pac HOT 2
- get_destination for local server not using direct connection since 0.8.0 HOT 8
- `_quickjs.JSException: InternalError: Python call failed.` with PAC file HOT 1
- Exit automatically if log = 0 HOT 4
- PAC file encoding HOT 11
- IPv6 connect support HOT 2
- have an option to launch in the background HOT 1
- px status command HOT 3
- Px related issues when other applocations make localhost request HOT 2
- hostonly and WSL2 HOT 7
- `curl: (56) Proxy CONNECT aborted` error with px 0.8 when using curl.exe HOT 7
- 'Requires libcurl' when using 'tools.py --libcurl' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from px.