Re: tcl - exec will block the main thread if not return on Windows



On Oct 30, 9:52 am, vian1...@xxxxxxxxxxxx wrote:
The exec manual said "To start an instance of notepad editing a file
without waiting for the user to finish editing the file: exec notepad
myfile.txt &", but I tried on my application, it throws an error that
"couldn't duplicate output handle: bad file number".
What's the problem?
On Unix, "exec vi myfile &" works well, I continue the operation on my
application without exiting vi.
On Windows, "exec notepad myfile.txt" will block my application, I
have to exit notepad before I can operate my application.
Does anyone know the reason?

Did you by any chance do something to stdout, like closing it ?
Or are you starting your app from outside a console, resulting in
somewhat invalid std channels ? In any case, I'd try

exec notepad < NUL: > NUL: 2> NUL: &

-Alex

.



Relevant Pages