You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TSEPro Support
I have a problem that I would like to ask for help with on
StackOverflow. But I'm having a hard time coming up with a good
title. Advice appreciated!
Title: Under WSL, Windows GUI program thinks stdin is a pipe when said
program is run asynchronously via "&"
Windows Version 10.0.19042.1826
WSL 2, running Ubuntu 20.04.4 LTS
Running a Windows GUI program on WSL:
1) $ g.exe
GetFileType() returns FILE_TYPE_UNKN
Works fine, but the WSL instance is not usable until g.exe terminates.
2) $ ls | g.exe
GetFileType() returns FILE_TYPE_PIPE
Works fine, and data is piped into the application. WSL instance is
not usable until g.exe terminates.
3) $ ls | g.exe &
GetFileType() returns FILE_TYPE_PIPE
Works fine, and data is piped into the application. WSL instance is
immediately available, as the "&" puts g.exe into the background. I
think :)
4) $ g.exe &
GetFileType() returns FILE_TYPE_PIPE
Hangs, because the application thinks stdin is a pipe, and waits
forever for input from it.
How can I somehow detect that nothing is being piped into g.exe?
S.E. Mitchell
unread,
Aug 6, 2022, 10:05:22 AM8/6/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TSEPro Support
And, the first scenario should have said "FILE_TYPE_CHAR"
1) $ g.exe
GetFileType() returns FILE_TYPE_CHAR
Works fine, but the WSL instance is not usable until g.exe terminates.
Carlo Hogeveen
unread,
Aug 6, 2022, 11:11:24 AM8/6/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sem...@googlegroups.com
Sammy,
I don't have the Windows and C knowledge to give you advice on what you asked for.
As a simple end user I would work around this problem by (probably from a short-named shell script) calling Windows GUI TSE from WSL with
g32.exe -eRestartTSE
where the macro RestartTSE.s is coded as:
proc Main()
Dos(LoadDir(TRUE), DOS_ASYNC_CALL_FLAGS)
AbandonEditor()
end Main
Carlo
Guy Rouillier
unread,
Aug 6, 2022, 8:57:23 PM8/6/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TSEPro Support
I'm on Windows 7, so no WSL, but I do have MSYS, which maybe works
similarly enough. In MSYS, your scenarios (1) and (4) work exactly the
same, they both hang. I think this is because when a process is put
into the background, STDIN is no longer available. I found this article
that suggests using PeekNamedPipe to avoid the hang: