3

Is there some way to read the PID of a process started with QProcess.start(...)? QProcess::pid() returns sip.voidptr and there's not much I can do with it (or I don't know how).

I want to have the PID to have the possibility to make the window active later on.

3 Answers 3

2

Try QProcess.startDetached since it spawns a standalone process, removing the possibility of sharing PID with its parent.

This might provide some you further insight.

Sign up to request clarification or add additional context in comments.

1 Comment

I know that startDetached returns pid of new process... but is there possibility of catch finished() signal? Also... it is a separate process anyway... so I don't get why it is not simplified?
0

Try:

proc = QtCore.QProcess().start(cmdOrWhaterver)
pid = int(proc.pid())

Not sure if this helps you or not but you can also try proc.setObjectName() which has worked for me when referencing a process after it has run for a bit.

that's for python anyway

Comments

0

pid() function is provided to keep old source code working. Use processId() instead. Returns the native process identifier for the running process, if available. If no process is currently running, 0 is returned. Note: Unlike processId(), pid() returns an integer on Unix and a pointer on Windows.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.